Toggle navigation
Ocean Color Science Software
Jump to content
ocssw
V2022
web
ocssw
ocssw_src
src
viirs_sim_sdr
time_utl.c
Go to the documentation of this file.
1
/*
2
subroutine jddate(jd,i,j,k)
3
C
4
C This routine computes the calendar date corresponding to
5
C a given Julian day. This code was brazenly copied from
6
C a routine written by Myron Shear for CSC on Julian Day 1.
7
C
8
C ARGUMENT TYPE I/O DESCRIPTION
9
C __________________________________________________________
10
C JD I*4 I Julian Day (reference Jan 1, 4713 BC)
11
C I I*4 O Year
12
C J I*4 O Month
13
C K I*4 0 Day of Month
14
C
15
l = jd + 68569
16
n = 4*l/146097
17
l = l - (146097*n + 3)/4
18
i = 4000*(l+1)/1461001
19
l = l - 1461*i/4 + 31
20
j = 80*l/2447
21
k = l - 2447*j/80
22
l = j/11
23
j = j + 2 - 12*l
24
i = 100*(n-49) + i + l
25
return
26
end
27
*/
28
29
/*
30
subroutine jdate(jd,i,k)
31
C
32
C This routine computes the year and day-of-year corresponding
33
C to a given Julian day. This algorithm is designed for the
34
C period 1900 - 2100.
35
C
36
C ARGUMENT TYPE I/O DESCRIPTION
37
C __________________________________________________________
38
C JD I*4 I Julian Day (reference Jan 1, 4713 BC)
39
C I I*4 O Year
40
C K I*4 0 Day of Year
41
C
42
c Program written by: Frederick S. Patt
43
c General Sciences Corporation
44
c May 12, 1993
45
46
c Compute days since January 0, 1900
47
l = jd - 2415020
48
49
c Compute years since 1900
50
i = 4*l/1461
51
52
c Compute day-of-year
53
k = l - 1461*(i-1)/4 - 365
54
55
c Add first two digits of year
56
i = i + 1900
57
return
58
end
59
*/
60
61
/*
62
function jd(i,j,k)
63
c
64
c
65
c This function converts a calendar date to the corresponding Julian
66
c day starting at noon on the calendar date. The algorithm used is
67
c from Van Flandern and Pulkkinen, Ap. J. Supplement Series 41,
68
c November 1979, p. 400.
69
c
70
c
71
c Arguments
72
c
73
c Name Type I/O Description
74
c ---- ---- --- -----------
75
c i I*4 I Year - e.g. 1970
76
c j I*4 I Month - (1-12)
77
c k I*4 I Day - (1-31)
78
c jd I*4 O Julian day
79
c
80
c external references
81
c -------------------
82
c none
83
c
84
c
85
c Written by Frederick S. Patt, GSC, November 4, 1992
86
c
87
c
88
jd = 367*i - 7*(i+(j+9)/12)/4 + 275*j/9 + k + 1721014
89
90
c This additional calculation is needed only for dates outside of the
91
c period March 1, 1900 to February 28, 2100
92
c jd = jd + 15 - 3*((i+(j-9)/7)/100+1)/4
93
return
94
end
95
*/
96
97
int
jd_c
(
int
y
,
int
m,
int
d) {
98
return
( 367 *
y
-
99
7 * (
y
+ (m + 9) / 12) / 4 +
100
275 * m / 9 +
101
d + 1721014);
102
}
jd_c
int jd_c(int y, int m, int d)
Definition:
time_utl.c:97
color_dtdb.y
y
Definition:
color_dtdb.py:430