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