/usr/share/gnudatalanguage/astrolib/ymd2dn.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ;-------------------------------------------------------------
;+
; NAME:
; YMD2DN
; PURPOSE:
; Convert from year and day number of year to month and day of month.
; CALLING SEQUENCE:
; dy = YMD2DN(yr,m,d)
; INPUTS:
; yr = 4 digit year (like 1988), integer scalar
; m = month number (1-12, e.g. 11 = Nov)
; d = day of month (like 5).
;
; OUTPUTS:
; dy = day number in year (like 310)
;
; MODIFICATION HISTORY:
; Adapted from ydn2md, Ole Streicher, 2015
;-
;-------------------------------------------------------------
FUNCTION YMD2DN,YR,M,D, help=hlp
IF (N_PARAMS() LT 3) or keyword_set(hlp) THEN BEGIN
PRINT,' Convert from year, month and day of month to '+$
'day of the year.'
PRINT,' ymd2dn,yr,m,d,dy'
PRINT,' yr = year (like 1988), scalar input'
PRINT,' m = month number (like 11 = Nov). input'
PRINT,' d = day of month (like 5). input'
PRINT,' dy = day number in year (like 310), out'
RETURN, -1
ENDIF
; Days before start of each month.
YDAYS = [0,31,59,90,120,151,181,212,243,273,304,334,366]
LEAP = (((YR MOD 4) EQ 0) AND ((YR MOD 100) NE 0)) OR $
((YR MOD 400) EQ 0)
DY = YDAYS[M-1] + (LEAP AND M GT 2) + D
RETURN, DY
END
|