NCEPLIBS-w3emc
2.9.3
w3fs26.f
Go to the documentation of this file.
1
C> @file
2
C> @brief Year, month, day from julian day number
3
C> @author Ralph Jones @date 1987-03-29
4
5
C> Computes year (4 digits), month, day, day of week, day of year from julian
6
C> day number. this subroutine will work from 1583 a.d. to 3300 a.d.
7
C>
8
C> ### Program History Log:
9
C> Date | Programmer | Comments
10
C> -----|------------|---------
11
C> 1987-03-29 | Ralph Jones |
12
C> 1989-10-25 | Ralph Jones | Convert to cray cft77 fortran
13
C>
14
C> @param[in] JLDAYN (INT) Julian day number
15
C> @param[out] IYEAR (INT) Year (4 digits)
16
C> @param[out] MONTH (INT) Month
17
C> @param[out] IDAY (INT) Day
18
C> @param[out] IDAYWK (INT) Day of week (1 is sunday, 7 is sat)
19
C> @param[out] IDAYYR (INT) Day of year (1 to 366)
20
C>
21
C> @note A julian day number can be computed by using one of the following
22
C> statement functions. A day of week can be computed from the julian day
23
C> number. A day of year can be computed from a julian day number and year.
24
C>
25
C> JDN(IYEAR,MONTH,IDAY) = IDAY - 32075
26
C> + 1461 * (IYEAR + 4800 + (MONTH - 14) / 12) / 4
27
C> + 367 * (MONTH - 2 - (MONTH -14) / 12 * 12) / 12
28
C> - 3 * ((IYEAR + 4900 + (MONTH - 14) / 12) / 100) / 4
29
C>
30
C> IYR (4 DIGITS) , IDYR(1-366) Day of year
31
C>
32
C> JULIAN(IYR,IDYR) = -31739 + 1461 * (IYR + 4799) / 4
33
C> -3 * ((IYR + 4899) / 100) / 4 + IDYR
34
C>
35
C> Day of week from julian day number, 1 is sunday, 7 is saturday.
36
C>
37
C> JDAYWK(JLDAYN) = MOD((JLDAYN + 1),7) + 1
38
C>
39
C> Day of year from julian day number and 4 digit year.
40
C>
41
C> JDAYYR(JLDAYN,IYEAR) = JLDAYN -
42
C> (-31739+1461*(IYEAR+4799)/4-3*((IYEAR+4899)/100)/4)
43
C>
44
C> The first function was in a letter to the editor communications
45
C> of the acm volume 11 / number 10 / october, 1968. the 2nd
46
C> function was derived from the first. This subroutine was also
47
C> included in the same letter. Julian day number 1 is
48
C> jan 1,4713 b.c. a julian day number can be used to replace a
49
C> day of century, this will take care of the date problem in
50
C> the year 2000, or reduce program changes to one line change
51
C> of 1900 to 2000. Julian day numbers can be used for finding
52
C> record numbers in an archive or day of week, or day of year.
53
C>
54
C> @author Ralph Jones @date 1987-03-29
55
SUBROUTINE
w3fs26
(JLDAYN,IYEAR,MONTH,IDAY,IDAYWK,IDAYYR)
56
C
57
l = jldayn + 68569
58
n = 4 * l / 146097
59
l = l - (146097 * n + 3) / 4
60
i = 4000 * (l + 1) / 1461001
61
l = l - 1461 * i / 4 + 31
62
j = 80 * l / 2447
63
iday = l - 2447 * j / 80
64
l = j / 11
65
month = j + 2 - 12 * l
66
iyear = 100 * (n - 49) + i + l
67
idaywk = mod((jldayn + 1),7) + 1
68
idayyr = jldayn -
69
& (-31739 +1461 * (iyear+4799) / 4 - 3 * ((iyear+4899)/100)/4)
70
RETURN
71
END
w3fs26
subroutine w3fs26(JLDAYN, IYEAR, MONTH, IDAY, IDAYWK, IDAYYR)
Computes year (4 digits), month, day, day of week, day of year from julian day number.
Definition:
w3fs26.f:56
src
w3fs26.f
Generated by
1.8.17