- Timestamp:
- 03/14/12 09:45:50 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ReadWrite/ncdf_gettime.pro
r470 r474 72 72 tobeclosed = 1 73 73 ENDIF 74 IF n_elements(caller) EQ 0 THEN caller = 'read_ncdf' 74 75 inq = ncdf_inquire(cdfid) 75 76 ;---------------------------------------------------- … … 204 205 ENDIF 205 206 start = str_sep(words[2], '-') 207 IF stregex(value, '[^ ]* since ([0-9]){1,4}-([0-9]){1,2}-([0-9]){1,2} ([0-9]){1,2}:([0-9]){1,2}:([0-9]){1,2}', /boolean) EQ 0 THEN BEGIN 208 print, 'hh:mm:ss of the calendar origin not found... -> start calendar at 00:00:00' 209 start = [start, '0', '0', '0'] 210 ENDIF ELSE start = [start, str_sep(words[3], ':')] 206 211 ENDIF ELSE units = value 207 212 ;---------------------------------------------------- … … 212 217 case units OF 213 218 'true julian day': 214 'second':time = julday(start[1], start[2], start[0], 0, 0, 0)+time/86400.d215 'minute':time = julday(start[1], start[2], start[0], 0, 0, 0)+time/1440.d216 'hour':time = julday(start[1], start[2], start[0], 0, 0, 0)+time/24.d217 'day':time = julday(start[1], start[2], start[0], 0, 0, 0)+time219 'second':time = julday(start[1], start[2], start[0], start[3], start[4], start[5])+time/86400.d 220 'minute':time = julday(start[1], start[2], start[0], start[3], start[4], start[5])+time/1440.d 221 'hour':time = julday(start[1], start[2], start[0], start[3], start[4], start[5])+time/24.d 222 'day':time = julday(start[1], start[2], start[0], start[3], start[4], start[5])+time 218 223 'month':BEGIN 219 224 if total(fix(time) NE time) NE 0 then $ ; we switch to days with 30d/m 220 time = julday(start[1], start[2], start[0], 0, 0, 0) + round(time*30) $221 ELSE time = julday(start[1]+fix(time), replicate(start[2], jpt), replicate(start[0], jpt), 0, 0, 0)225 time = julday(start[1], start[2], start[0], start[3], start[4], start[5]) + round(time*30) $ 226 ELSE time = julday(start[1]+fix(time), replicate(start[2], jpt), replicate(start[0], jpt), start[3], start[4], start[5]) 222 227 END 223 228 'year':BEGIN 224 229 if total(fix(time) NE time) NE 0 then $ ; we switch to days with 365d/y 225 time = julday(start[1], start[2], start[0], 0, 0, 0) + round(time*365) $226 ELSE time = julday(replicate(start[1], jpt), replicate(start[2], jpt), start[0]+fix(time), 0, 0, 0)230 time = julday(start[1], start[2], start[0], start[3], start[4], start[5]) + round(time*365) $ 231 ELSE time = julday(replicate(start[1], jpt), replicate(start[2], jpt), start[0]+fix(time), start[3], start[4], start[5]) 227 232 END 228 233 ENDCASE
Note: See TracChangeset
for help on using the changeset viewer.