- Timestamp:
- 01/27/09 09:59:35 (15 years ago)
- Location:
- trunk/SRC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ReadWrite/ncdf_gettime.pro
r370 r389 11 11 ; the name of the ncdf_file 12 12 ; 13 ; @param cdfid {in}{required}{type=scalar} 14 ; the ID of the ncdf_file, which is already open 13 ; @param cdfid {in}{optional}{type=scalar} 14 ; the ID of the ncdf_file, if the file is already open. 15 ; if not provided, ncdf_gettime open the file defined by filename 15 16 ; 16 17 ; @keyword TIMEVAR {type=string} … … 53 54 ;- 54 55 FUNCTION ncdf_gettime, filename, cdfid $ 55 , TIMEVAR=timevar, CALLER=caller, ERR=err, _EXTRA=ex56 , TIMEVAR = timevar, CALLER = caller, ERR = err, _EXTRA = ex 56 57 ; 57 58 compile_opt idl2, strictarrsubs … … 59 60 @cm_4cal ; needed for key_caltype 60 61 ; 62 IF n_elements(cdfid) EQ 0 THEN BEGIN 63 cdfid = ncdf_open(isafile(filename, title = 'which file must be open by ncdf_gettime?', _extra = ex)) 64 tobeclosed = 1 65 ENDIF 61 66 inq = ncdf_inquire(cdfid) 62 67 ;---------------------------------------------------- … … 66 71 IF keyword_set(timevar) THEN BEGIN 67 72 timeid = ncdf_varid(cdfid, timevar) 68 IF timeid EQ -1 THEN BEGIN 73 IF timeid EQ -1 THEN BEGIN ; the variable is not found 69 74 CASE caller OF 70 75 'read_ncdf':err = 'No variable ' + timevar + 'found in '+filename+'. Use the TIMESTEP keyword' 71 76 'scanfile':err = 'No variable ' + timevar + 'found in '+filename+'. We create a fake calendar' 72 77 ENDCASE 78 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 73 79 return, -1 74 80 ENDIF … … 84 90 'scanfile':err = 'the file '+filename+' as no infinite dimension. We create a fake calendar' 85 91 ENDCASE 92 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 86 93 return, -1 87 94 ENDIF … … 90 97 ; we look for the first variable having for only dimension inq.recdim 91 98 timeid = 0 92 REPEAT BEGIN ; As long as we have not find a variable having only one dimension: the infinite one99 REPEAT BEGIN ; As long as we have not find a variable having only one dimension: the infinite one 93 100 timeinq = ncdf_varinq(cdfid, timeid) ; that the variable contain. 94 101 timeid = timeid+1 … … 100 107 'scanfile':err = 'the file '+fullname+' has no time axis.!C we create a fake calendar ...' 101 108 ENDCASE 109 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 102 110 return, -jpt 103 111 ENDIF … … 113 121 'scanfile':err = 'the variable '+timeinq.name+' has no attribute.!C we create a fake calendar ...' 114 122 ENDCASE 123 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 115 124 return, -jpt 116 125 ENDIF … … 124 133 'scanfile':err = 'Attribute ''units'' not found for the variable '+timeinq.name+'!C we create a fake calendar ...' 125 134 ENDCASE 135 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 126 136 return, -jpt 127 137 ENDIF … … 158 168 'scanfile':err = 'time units does not start with seconds/hours/days/months/years !C we create a fake calendar ...' 159 169 ENDCASE 170 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 160 171 return, -jpt 161 172 ENDIF … … 165 176 'scanfile':err = 'attribute units of time has not the good format: [^ ]* since ([0-9]){1,4}-([0-9]){1,2}-([0-9]){1,2}.*!C we create a fake calendar ...' 166 177 ENDCASE 178 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 167 179 return, -jpt 168 180 ENDIF … … 192 204 time = double(time) 193 205 ; 206 IF keyword_set(tobeclosed) THEN ncdf_close, cdfid 194 207 return, time 195 208 END -
trunk/SRC/Utilities/undefine.pro
r375 r389 38 38 compile_opt idl2, strictarrsubs 39 39 ; 40 tempvar = SIZE(TEMPORARY(varname))40 IF n_elements(varname) NE 0 THEN tempvar = SIZE(TEMPORARY(varname)) 41 41 END
Note: See TracChangeset
for help on using the changeset viewer.