source: flexpart.git/src/juldate.f90

10.4.1_peseiGFS_025bugfixes+enhancementsdevrelease-10release-10.4.1scaling-bug
Last change on this file was 92fab65, checked in by Ignacio Pisso <ip@…>, 4 years ago

add SPDX-License-Identifier to all .f90 files

  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[92fab65]1! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
2! SPDX-License-Identifier: GPL-3.0-or-later
[332fbbd]3
[e200b7a]4function juldate(yyyymmdd,hhmiss)
5
6  !*****************************************************************************
7  !                                                                            *
8  !     Calculates the Julian date                                             *
9  !                                                                            *
10  !     AUTHOR: Andreas Stohl (15 October 1993)                                *
11  !                                                                            *
12  !     Variables:                                                             *
13  !     dd             Day                                                     *
14  !     hh             Hour                                                    *
15  !     hhmiss         Hour, minute + second                                   *
16  !     ja,jm,jy       help variables                                          *
17  !     juldate        Julian Date                                             *
18  !     julday         help variable                                           *
19  !     mi             Minute                                                  *
20  !     mm             Month                                                   *
21  !     ss             Second                                                  *
22  !     yyyy           Year                                                    *
23  !     yyyymmddhh     Date and Time                                           *
24  !                                                                            *
25  !     Constants:                                                             *
26  !     igreg          help constant                                           *
27  !                                                                            *
28  !*****************************************************************************
29
30  use par_mod, only: dp
31
32  implicit none
33
34  integer           :: yyyymmdd,yyyy,mm,dd,hh,mi,ss,hhmiss
35  integer           :: julday,jy,jm,ja
36  integer,parameter :: igreg=15+31*(10+12*1582)
37  real(kind=dp)     :: juldate
38
39  yyyy=yyyymmdd/10000
40  mm=(yyyymmdd-10000*yyyy)/100
41  dd=yyyymmdd-10000*yyyy-100*mm
42  hh=hhmiss/10000
43  mi=(hhmiss-10000*hh)/100
44  ss=hhmiss-10000*hh-100*mi
45
46  if (yyyy.eq.0) then
47     print*, 'there is no year zero.'
48     stop
49  end if
50  if (yyyy.lt.0) yyyy=yyyy+1
51  if (mm.gt.2) then
52    jy=yyyy
53    jm=mm+1
54  else
55    jy=yyyy-1
56    jm=mm+13
57  endif
58  julday=int(365.25*jy)+int(30.6001*jm)+dd+1720995
59  if (dd+31*(mm+12*yyyy).ge.igreg) then
60    ja=int(0.01*jy)
61    julday=julday+2-ja+int(0.25*ja)
62  endif
63
64  juldate=real(julday,kind=dp)   + real(hh,kind=dp)/24._dp + &
65       real(mi,kind=dp)/1440._dp  + real(ss,kind=dp)/86400._dp
66
67end function juldate
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG