Changeset 167 for trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
- Timestamp:
- 09/05/06 14:24:07 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
r150 r167 114 114 namedim[dimiq] = strlowcase(tmpname) 115 115 ENDFOR 116 ; we are looking for a x dimension... 117 dimidx = where(namedim EQ 'x' OR strmid(namedim, 0, 3) EQ 'lon' OR strmid(namedim, 0, 3) EQ 'xi_' OR namedim EQ 'xt_i7_156') 118 dimidx = dimidx[0] 119 if dimidx EQ -1 then begin 120 print, 'one of the dimensions must have the name: ''x'' or ''lon...'' or ''xi_...'' or ''xt_i7_156''' 121 stop 122 endif 123 ; we are looking for a y dimension... 124 dimidy = where(namedim EQ 'y' OR strmid(namedim, 0, 3) EQ 'lat' OR strmid(namedim, 4) EQ 'eta_' OR namedim EQ 'yt_j6_75') 125 dimidy = dimidy[0] 126 if dimidy EQ -1 then begin 127 print, 'one of the dimensions must have the name: ''y'' or ''lat...'' or ''eta_...'' or ''yt_j6_75''' 128 stop 129 endif 116 ; we are looking for a x dimension with a name matching one of the following regular expression: 117 testname = ['longitude', 'lon', 'x', 'longitude*', 'lon*', 'x*', '*longitude*', '*lon*', '*x*'] 118 cnt = -1 119 ii = 0 120 WHILE cnt NE 1 AND ii LT n_elements(testname) DO BEGIN 121 dimidx = where(strmatch(namedim, testname[ii]) EQ 1, cnt) 122 ii = ii+1 123 ENDWHILE 124 CASE cnt OF 125 0:begin 126 dummy = report(['none of the dimensions name matches one of the following regular expression:' $ 127 , '''longitude'', ''lon'', ''x'', ''longitude*'', ''lon*'', ''x*'', ''*longitude*'', ''*lon*'', ''*x*''' $ 128 , ' => we cannot find the x dimension']) 129 stop 130 END 131 1:dimidx = dimidx[0] 132 ELSE:begin 133 dummy = report(['several (and not one unique) dimensions name matches the following regular expression:' $ 134 , '''longitude'', ''lon'', ''x'', ''longitude*'', ''lon*'', ''x*'', ''*longitude*'', ''*lon*'', ''*x*''' $ 135 , ' => we cannot find the x dimension']) 136 stop 137 END 138 ENDCASE 139 ; we are looking for a y dimension with a name matching one of the following regular expression: 140 testname = ['latitude', 'lat', 'y', 'latitude*', 'lat*', 'y*', 'eta_*', '*latitude*', '*lat*', '*y*'] 141 cnt = -1 142 ii = 0 143 WHILE cnt NE 1 AND ii LT n_elements(testname) DO BEGIN 144 dimidy = where(strmatch(namedim, testname[ii]) EQ 1, cnt) 145 ii = ii+1 146 ENDWHILE 147 CASE cnt OF 148 0:begin 149 dummy = report(['none of the dimensions name matches one of the following regular expression:' $ 150 , '''latitude'', ''lat'', ''y'', ''latitude*'', ''lat*'', ''y*'', ''eta_*'', ''*latitude*'', ''*lat*'', ''*y*''' $ 151 , ' => we cannot find the y dimension']) 152 stop 153 END 154 1:dimidy = dimidy[0] 155 ELSE:begin 156 dummy = report(['several (and not one unique) dimensions name matches the following regular expression:' $ 157 , '''latitude'', ''lat'', ''y'', ''latitude*'', ''lat*'', ''y*'', ''eta_*'', ''*latitude*'', ''*lat*'', ''*y*''' $ 158 , ' => we cannot find the x dimension']) 159 stop 160 END 161 ENDCASE 130 162 ;------------------------------------------------------------ 131 163 ; name of all variables … … 156 188 varid = 0 157 189 repeat BEGIN 158 invar = ncdf_varinq(cdfid, varid) 159 varid = varid+1 160 endrep until n_elements(invar.dim) EQ 1 AND invar.dim[0] EQ infile.recdim 190 IF varid LT infile.nvars THEN BEGIN 191 invar = ncdf_varinq(cdfid, varid) 192 varid = varid+1 193 ENDIF ELSE varid = 0 194 endrep until (n_elements(invar.dim) EQ 1 AND invar.dim[0] EQ infile.recdim) OR (varid EQ 0) 161 195 varid = varid-1 162 196 ; … … 179 213 for attiq = 0, invar.natts-1 do attnames[attiq] = ncdf_attname(cdfid, varid, attiq) 180 214 if (where(attnames EQ 'units'))[0] EQ -1 then BEGIN 181 dummy = report('Attribut ''units'' not found for the variable '+ varid.name+'!C we create a fake calendar ...')215 dummy = report('Attribut ''units'' not found for the variable '+invar.name+'!C we create a fake calendar ...') 182 216 fakecal = 1 183 217 time = date0fk + lindgen(jpt) … … 218 252 ENDELSE 219 253 ; 220 ; BEWARE we have to recuperate the calendar attribute and ajust TIMEby consequence...221 ; 222 ; 223 ; We pass TIMEin IDL julian days254 ; BEWARE we have to get back the calendar attribute and ajust time by consequence... 255 ; 256 ; 257 ; We pass time in IDL julian days 224 258 ; 225 259 unite = strlowcase(unite)
Note: See TracChangeset
for help on using the changeset viewer.