Changeset 226 for trunk/SRC/Calendar/julday.pro
- Timestamp:
- 03/16/07 10:22:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Calendar/julday.pro
r205 r226 4 4 ; Calculate the Julian Day Number for a given month, day, and year. 5 5 ; This is the inverse of the library function CALDAT. 6 ; 3 calendars are available according to the value of key_caltype 6 ; 3 calendars are available according to the value of key_caltype 7 7 ; (variable of the common file cm_4cal): 'greg', '360d', 'noleap' 8 8 ; 9 9 ; @categories Calendar 10 10 ; 11 ; @param MONTH {in}{required} 12 ; Number of the desired month (1 = January, ..., 12 = December). 11 ; @param MONTH {in}{required} 12 ; Number of the desired month (1 = January, ..., 12 = December). 13 13 ; Can be scalar or array 14 14 ; 15 ; @param DAY {in}{required} 15 ; @param DAY {in}{required} 16 16 ; Number of day of the month.Can be scalar or array 17 17 ; 18 ; @param YEARin {in}{required} 18 ; @param YEARin {in}{required} 19 19 ; Number of the desired year.Year parameters must be valid 20 20 ; values from the civil calendar. Years B.C.E. are represented … … 22 22 ; as positive integers. In particular, note that there is no 23 23 ; year 0 in the civil calendar. 1 B.C.E. (-1) is followed by 24 ; 1 C.E. (1). 25 ; Change: However for climatological year, we do accept the year 24 ; 1 C.E. (1). 25 ; Change: However for climatological year, we do accept the year 26 26 ; O but we change it for year 654321L (the same trick is done in 27 27 ; caldat so caldat, julday(1,1,0) gives you back Jan 1st of year 0) 28 28 ; Can be scalar or array 29 29 ; 30 ; @param HOUR {in}{optional}{default=12} 30 ; @param HOUR {in}{optional}{default=12} 31 31 ; Number of the hour of the day. Can be scalar or array 32 32 ; … … 37 37 ; Number of the second of the minute. Can be scalar or array 38 38 ; 39 ; @restrictions 39 ; @restrictions 40 40 ; The Result will have the same dimensions as the smallest array, or 41 41 ; will be a scalar if all arguments are scalars. 42 ; 43 ; @keyword NDAYSPM {default=30} 42 ; 43 ; @keyword NDAYSPM {default=30} 44 44 ; To use a calendar with fixed number of days per months. 45 45 ; see also the use of key_caltype (variable of the common file cm_4cal) 46 46 ; 47 ; @returns 47 ; @returns 48 48 ; the Julian Day Number (which begins at noon) of the specified calendar date. 49 ; If Hour, Minute, and Second are not specified, then the result will be a 50 ; long integer, otherwise the result is a double precision floating point 49 ; If Hour, Minute, and Second are not specified, then the result will be a 50 ; long integer, otherwise the result is a double precision floating point 51 51 ; number. 52 52 ; 53 53 ; @uses cm_4cal 54 54 ; 55 ; @restrictions 55 ; @restrictions 56 56 ; Accuracy using IEEE double precision numbers is approximately 57 57 ; 1/10000th of a second, with higher accuracy for smaller (earlier) 58 58 ; Julian dates. 59 59 ; 60 ; @history 60 ; @history 61 61 ; Translated from "Numerical Recipies in C", by William H. Press, 62 62 ; Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. … … 75 75 ; eg. julday(349,1,1970) 76 76 ; 77 ; Sebastien Masson, May 2006, add dif erent calendat with key_caltype77 ; Sebastien Masson, May 2006, add different calendat with key_caltype 78 78 ; (variable of the common file cm_4cal) 79 79 ; 80 ; @version $Id$ 80 ; @version 81 ; $Id$ 81 82 ;- 82 83 ; … … 224 225 RETURN, jul 225 226 226 END 227 END 227 228 '360d':BEGIN 228 229 ; … … 240 241 IF neg[0] NE -1 THEN L_YEAR[neg] = L_YEAR[neg]+1 241 242 242 JUL = ((L_YEAR-1)*12 + (L_MONTH-1))* ndayspm + L_DAY 243 JUL = ((L_YEAR-1)*12 + (L_MONTH-1))* ndayspm + L_DAY 243 244 if n_elements(Hour) + n_elements(Minute) + n_elements(Second) eq 0 then $ 244 245 return, JUL … … 246 247 if n_elements(Minute) eq 0 then Minute = 0 247 248 if n_elements(Second) eq 0 then Second = 0 248 249 249 250 IF total([hour NE 12, minute NE 0, second NE 0]) EQ 0 THEN return, JUL ELSE $ 250 251 return, JUL + (Hour / 24.0d0 - 0.5d) + (Minute/1440.0d0) + (Second / 86400.0d0) 251 252 252 END 253 END 253 254 'noleap':BEGIN 254 255 … … 279 280 if n_elements(Minute) eq 0 then Minute = 0 280 281 if n_elements(Second) eq 0 then Second = 0 281 282 282 283 IF total([hour NE 12, minute NE 0, second NE 0]) EQ 0 THEN return, JUL ELSE $ 283 284 return, JUL + (Hour / 24.0d0 - 0.5d) + (Minute/1440.0d0) + (Second / 86400.0d0) 284 285 285 END 286 END 286 287 ELSE:return, report('only 3 types of calendar are accepted: greg, 360d and noleap') 287 288 ENDCASE
Note: See TracChangeset
for help on using the changeset viewer.