Changeset 231 for trunk/SRC/Calendar/caldat.pro
- Timestamp:
- 03/19/07 18:15:51 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Calendar/caldat.pro
r205 r231 3 3 ; @file_comments 4 4 ; Return the calendar date and time given julian date. 5 ; This is the inverse of the function JULDAY. 6 ; 3 calendars are available according to the value of key_caltype 5 ; This is the inverse of the function 6 ; <pro>julday</pro>. 7 ; 3 calendars are available according to the value of key_caltype 7 8 ; (variable of the common file cm_4cal): 'greg', '360d', 'noleap' 8 9 ; 9 10 ; @categories Calendar 10 11 ; 11 ; @param JULIAN {in}{required} 12 ; @param JULIAN {in}{required} {type=long integer} 12 13 ; contains the Julian Day Number (which begins at noon) of the 13 ; specified calendar date. It should be a long integer.14 ; 15 ; @param MONTH {out} 14 ; specified calendar date. 15 ; 16 ; @param MONTH {out} {type=integer} 16 17 ; Number of the desired month (1 = January, ..., 12 = December). 17 18 ; 18 ; @param DAY {out} 19 ; @param DAY {out} {type=integer} 19 20 ; Number of day of the month. 20 21 ; 21 ; @param YEAR {out} 22 ; @param YEAR {out} {type=integer} 22 23 ; Number of the desired year. 23 24 ; 24 ; @param HOUR {out} 25 ; @param HOUR {out} {type=integer} 25 26 ; Hour of the day 26 27 ; 27 ; @param Minute {out} 28 ; @param Minute {out} {type=integer} 28 29 ; Minute of the day 29 30 ; 30 ; @param Second {out} 31 ; @param Second {out} {type=float} 31 32 ; Second (and fractions) of the day. 32 33 ; 33 ; @keyword NDAYSPM { default=30}34 ; To use a calendar with fixed number of days per month s.34 ; @keyword NDAYSPM {type=integer} {default=30} 35 ; To use a calendar with fixed number of days per month. 35 36 ; see also the use of key_caltype (variable of the common file cm_4cal) 36 37 ; 37 38 ; @uses cm_4cal 38 39 ; 39 ; @restrictions 40 ; Accuracy using IEEE double precision numbers is approximately 1/10000th of a 40 ; @restrictions 41 ; Accuracy using IEEE double precision numbers is approximately 1/10000th of a 41 42 ; second. 42 43 ; 43 ; @history 44 ; @history 44 45 ; Translated from "Numerical Recipies in C", by William H. Press, 45 46 ; Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. … … 55 56 ; AB, 3 January 2000, Make seconds output as DOUBLE in array output. 56 57 ; 57 ; Sebastien Masson, May 2006, add different calenda t with key_caltype58 ; Sebastien Masson, May 2006, add different calendar with key_caltype 58 59 ; (variable of the common file cm_4cal) 59 60 ; 60 ; @version $Id$ 61 ; @version 62 ; $Id$ 61 63 ;- 64 ; 62 65 pro caldat, julian, month, day, year, hour, minute, second, NDAYSPM = ndayspm 63 ; ------------------------------------------------------------66 ; 64 67 @cm_4cal 65 ; ------------------------------------------------------------66 COMPILE_OPT idl268 ; 69 compile_opt idl2, strictarrsubs 67 70 68 71 ON_ERROR, 2 ; Return to caller if errors … … 112 115 year = year - (year LE 0) 113 116 114 END 117 END 115 118 '360d':BEGIN 116 119 117 120 IF keyword_set(ndayspm) THEN BEGIN 118 121 IF ndayspm EQ 1 THEN ndayspm = 30 … … 137 140 neg = where(year LT 0) 138 141 IF neg[0] NE -1 THEN year[neg] = year[neg]-1 139 END 142 END 140 143 'noleap':BEGIN 141 144 … … 150 153 + (day GT 273) + (day GT 304) + (day GT 334) 151 154 month = long(month) 152 ; 155 ; 153 156 day = day - 31L * (day GT 31) - 28L * (day GT 59) - 31L * (day GT 90) $ 154 157 - 30L * (day GT 120) - 31L * (day GT 151) - 30L * (day GT 181) $ … … 160 163 month[zero] = 12L 161 164 day[zero] = 31L 162 ENDIF 163 ; 164 END 165 ENDIF 166 ; 167 END 165 168 ELSE:BEGIN 166 169 ng = report('only 3 types of calendar are accepted: greg, 360d and noleap') … … 180 183 second = (TEMPORARY(fraction) - minute/1440d) * 86400d 181 184 ENDIF 182 185 183 186 ; if julian is an array, reform all output to correct dimensions 184 187 IF (SIZE(julian, /N_DIMENSION) GT 0) THEN BEGIN
Note: See TracChangeset
for help on using the changeset viewer.