OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
julian.f
Go to the documentation of this file.
1  SUBROUTINE julian(TIN,TOUT)
2 C VERSION OF 4/1/85
3 C PURPOSE
4 C COMPUTES JULIAN DATE WHEN GIVEN CALENDER DATE AND TIME
5 C INPUT
6 C TIN(1) = CALENDER DATE, YYYYMMDD.
7 C (2) = CALENDER TIME, HHMMSS.SSSS
8 C OUTPUT
9 C TOUT = JULIAN DATE (DAYS)
10 C CALL SUBROUTINES
11 C NONE
12 C REFERENCES
13 C JPL EM 312/87-153, 20 APRIL 1987
14 C ANALYSIS
15 C J. H. KWOK
16 C PROGRAMMER
17 C J. H. KWOK
18 C PROGRAM MODIFICATIONS
19 C NONE
20 C COMMENTS
21 C NONE
22 C
23  IMPLICIT DOUBLE PRECISION (a-h,o-z)
24  dimension tin(2)
25  DATA d0,d1,d2,d3,d4,d5/2415020.5d0,1.d-4,1.d-2,24.d0,1.44d3
26  1,8.64d4/
27 C
28 C THIS IS THE JULIAN DATE FOR 19000101
29 C
30  tout=d0
31 C
32  iy=int(tin(1)*d1-1.9d3)
33  im=int(tin(1)*d2-1.9d5)-iy*100
34  id=int(tin(1)-1.9d7)-iy*10000-im*100
35  ihour=int(tin(2)*d1)
36  imin=int(tin(2)*d2)-ihour*100
37  sec=tin(2)-ihour*10000-imin*100
38  jd=iy*365+(iy-1)/4
39  im1=im-1
40  IF (im1.EQ.0) GO TO 12
41  GO TO (1,2,3,4,5,6,7,8,9,10,11),im1
42  1 jd=jd+31
43  GO TO 12
44  2 jd=jd+59
45  GO TO 12
46  3 jd=jd+90
47  GO TO 12
48  4 jd=jd+120
49  GO TO 12
50  5 jd=jd+151
51  GO TO 12
52  6 jd=jd+181
53  GO TO 12
54  7 jd=jd+212
55  GO TO 12
56  8 jd=jd+243
57  GO TO 12
58  9 jd=jd+273
59  GO TO 12
60  10 jd=jd+304
61  GO TO 12
62  11 jd=jd+334
63  12 CONTINUE
64  IF (iy/4*4-iy.EQ.0.AND.im.GT.2) jd=jd+1
65  jd=jd+id-1
66  tout=tout+jd+ihour/d3+imin/d4+sec/d5
67  RETURN
68  END
Definition: jd.py:1
integer function julian(DAY, MONTH, YEAR)
Definition: julian.f:2