Changeset 362
- Timestamp:
- 07/29/08 11:00:03 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Interpolation/file_interp.pro
r358 r362 6 6 FUNCTION call_interp2d, data, inlon, inlat, inmask, outlon, outlat $ 7 7 , INIRR=inirr, METHOD=method, SMOOTH=smooth $ 8 , WEIG=weig, ADDR=addr, NAN_VALUE=NaN_value, _EXTRA=ex8 , WEIG=weig, ADDR=addr, MISSING_VALUE=missing_value, _EXTRA=ex 9 9 ; 10 10 compile_opt idl2, strictarrsubs … … 15 15 ; 16 16 ; take care of NaN values 17 mask = inmask *finite(data) 18 ; 19 IF keyword_set(NaN_value) THEN BEGIN 17 nanmsk = finite(data) 18 IF total(nanmsk) NE n_elements(nanmsk) THEN BEGIN 19 data[where(nanmsk EQ 0b)] = 1.e20 ; put large value to be sure they are removed during the interpolation 20 mask = inmask * temporary(nanmsk) 21 ENDIF ELSE mask = inmask 22 ; 23 tpmiss = size(missing_value, /type) 24 IF tpmiss NE 0 AND tpmiss NE 7 THEN BEGIN 20 25 CASE 1 OF 21 nan_value GT 1.e6:mask = temporary(mask) * (data LT (nan_value-10.))22 nan_value LT -1.e6:mask = temporary(mask) * (data GT (nan_value+10.))23 abs( nan_value) LT 1.e-6:mask = temporary(mask) * (abs(data) GT 1.e-6)24 ELSE:mask = temporary(mask) * (data NE nan_value)26 missing_value GT 1.e6:mask = temporary(mask) * (data LT (missing_value-10.)) 27 missing_value LT -1.e6:mask = temporary(mask) * (data GT (missing_value+10.)) 28 abs(missing_value) LT 1.e-6:mask = temporary(mask) * (abs(data) GT 1.e-6) 29 ELSE:mask = temporary(mask) * (data NE missing_value) 25 30 ENDCASE 26 31 ENDIF … … 142 147 ; @keyword INMISSING_VALUE {type=scalar} 143 148 ; To define (or redefine if the attribute is already existing) the 144 ; missing values used with INUSEASMASK keyword. Note that this value is 145 ; not used if INTESTOP keyword is given and contains 2 words. 149 ; missing values used with INUSEASMASK keyword to build the input mask. 150 ; Note that this value is not used if INTESTOP keyword is given and 151 ; contains 2 words. 152 ; Note: do not mismatch with MISSING_VALUE used to detect missing 153 ; values at reach record. 146 154 ; 147 155 ; @keyword OUTMISSING_VALUE {type=scalar} … … 154 162 ; INTESTOP can contain 1 or 2 words. The first word is the operator 155 163 ; definition: "EQ" "NE" "GE" "GT" "LE" "LT" (default is NE). The 156 ; second word define the testing value. If TESTOP contains only 1164 ; second word define the testing value. If INTESTOP contains only 1 157 165 ; word, then the test value is denifed by 158 ; 1) MISSING_VALUE keyword159 ; 2) attribute missing_value or _fillvalue of the variable USEASMASK166 ; 1) INMISSING_VALUE keyword 167 ; 2) attribute missing_value or _fillvalue of the variable INUSEASMASK 160 168 ; 3) !Values.f_nan (can be used only with NE and EQ operators) 161 169 ; … … 170 178 ; same as inaddscl_before but for output mask file maskout 171 179 ; 172 ; @keyword NAN_VALUE {type=scalar}{default=not used}173 ; define the missing value in input data (missing values are treated180 ; @keyword MISSING_VALUE {type=scalar}{default=defined by attribute missing_value or _fillvalue} 181 ; (Re)define the missing value in input data (missing values are treated 174 182 ; like masked values and will be filled with extrapolation before 175 ; interpolation). 183 ; interpolation). 184 ; Note: do not mismatch with (IN/OUT)MISSING_VALUE which are missing value 185 ; used (in association with (IN/OUT)USEASMASK) to built the mask (that 186 ; does not change from one record to another). 187 ; Note: this value will be apply to all interpolated variables 176 188 ; 177 189 ; @keyword ADDR {type=2d array or variable name} … … 222 234 ; IDL> file_interp, filein, fileout, gridout, inxaxisname = 'lo', inyaxisname = 'la', keep = ['lo', 'la', 'cond_sed'] 223 235 ; 224 ; IDL> file_interp, in, out, gdout, inuseasmask = 'sst', inmissing_value = -1.00000e+30, nan_value = -1000.00236 ; IDL> file_interp, in, out, gdout, inuseasmask = 'sst', inmissing_value = -1.00000e+30, missing_value = -1000.00 225 237 ; 226 238 ; @history … … 241 253 , OUTUSEASMASK=outuseasmask, OUTMISSING_VALUE=outmissing_value $ 242 254 , OUTADDSCL_BEFORE=outaddscl_before, OUTTESTOP = outtestop $ 243 , NAN_VALUE=NaN_value, WEIG=weig, ADDR=addr $255 , MISSING_VALUE=MISSING_VALUE, WEIG=weig, ADDR=addr $ 244 256 , INXAXISNAME=inxaxisname, INYAXISNAME=inyaxisname $ 245 257 , OUTXAXISNAME=outxaxisname, OUTYAXISNAME=outyaxisname $ … … 409 421 END 410 422 ELSE:BEGIN 423 IF n_elements(missing_value) NE 0 THEN var_missing_value = MISSING_VALUE $ 424 ELSE ncdf_getatt, inid, i, MISSING_VALUE = var_missing_value 411 425 CASE varinq.ndims OF 412 426 0:BEGIN ; salar … … 422 436 IF interp THEN data = call_interp2d(temporary(data), inlon, inlat, inmask[*, *, 0], outlon, outlat $ 423 437 , INIRR = inirr, METHOD = method, SMOOTH = smooth $ 424 , WEIG = weig, ADDR = addr, NAN_VALUE = NaN_value, _extra = ex)438 , WEIG = weig, ADDR = addr, MISSING_VALUE = var_missing_value, _extra = ex) 425 439 ncdf_varput, outid, outvarid[i], temporary(data) 426 440 END … … 437 451 IF interp THEN data = call_interp2d(temporary(data), inlon, inlat, temporary(tmpmsk), outlon, outlat $ 438 452 , INIRR = inirr, METHOD = method, SMOOTH = smooth $ 439 , WEIG = weig, ADDR = addr, NAN_VALUE = NaN_value, _extra = ex)453 , WEIG = weig, ADDR = addr, MISSING_VALUE = var_missing_value, _extra = ex) 440 454 ncdf_varput, outid, outvarid[i], temporary(data), offset = off, count = outcnt 441 455 ENDFOR … … 453 467 IF interp THEN data = call_interp2d(temporary(data), inlon, inlat, temporary(tmpmsk), outlon, outlat $ 454 468 , INIRR = inirr, METHOD = method, SMOOTH = smooth $ 455 , WEIG = weig, ADDR = addr, NAN_VALUE = NaN_value, _extra = ex)469 , WEIG = weig, ADDR = addr, MISSING_VALUE = var_missing_value, _extra = ex) 456 470 ncdf_varput, outid, outvarid[i], temporary(data), offset = off, count = outcnt 457 471 ENDFOR
Note: See TracChangeset
for help on using the changeset viewer.