- Timestamp:
- 11/06/08 03:32:33 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Interpolation/extrapolate.pro
r381 r384 20 20 ; is no more masked values we exit extrapolate before reaching nb_iteration 21 21 ; 22 ; @keyword FILLXDIR {type=scalar, 0 or 1}{default=0} 23 ; put 1 to specify that filling of the data must be done only along x direction 24 ; 25 ; @keyword FILLYDIR {type=scalar, 0 or 1}{default=0} 26 ; put 1 to specify that filling of the data must be done only along y direction 27 ; 22 28 ; @keyword X_PERIODIC {type=scalar, 0 or 1}{default=0} 23 29 ; put 1 to specify that the data are periodic along x axis … … 57 63 ; 58 64 ;- 59 FUNCTION extrapolate, zinput, maskinput, nb_iteration, X_PERIODIC=x_periodic$60 , MINVAL=minval, MAXVAL=maxval, GE0=ge0, _EXTRA=ex65 FUNCTION extrapolate, zinput, maskinput, nb_iteration, FILLXDIR = fillxdir, FILLYDIR = fillydir $ 66 , X_PERIODIC = x_periodic, MINVAL=minval, MAXVAL=maxval, GE0=ge0, _EXTRA=ex 61 67 ; 62 68 compile_opt idl2, strictarrsubs … … 118 124 ; find the land points 119 125 land = where(msk EQ 0, cnt_land) 126 IF keyword_set(fillxdir) THEN BEGIN 127 tst = total(msk[1:nx, 1:ny], 1) 128 cnt_land = total(tst NE 0 AND tst NE nx) 129 ENDIF 130 IF keyword_set(fillydir) THEN BEGIN 131 tst = total(msk[1:nx, 1:ny], 2) 132 cnt_land = total(tst NE 0 AND tst NE ny) 133 ENDIF 120 134 ;--------------------------------------------------------------- 121 135 WHILE cnt LE nb_iteration AND cnt_land NE 0 DO BEGIN … … 149 163 ; border of the array, we can compute the weight without shift 150 164 ; (faster). 151 ; 152 weight = msk[land+1]+msk[land-1]+msk[land+nx2]+msk[land-nx2] $ 153 +sqrtinv*(msk[land+nx2+1]+msk[land+nx2-1] $ 154 +msk[land-nx2+1]+msk[land-nx2-1]) 165 ; 166 CASE 1 OF 167 keyword_set(fillxdir):weight = msk[land+1]+msk[land-1] 168 keyword_set(fillydir):weight = msk[land+nx2]+msk[land-nx2] 169 ELSE:weight = msk[land+1]+msk[land-1]+msk[land+nx2]+msk[land-nx2] $ 170 +sqrtinv*(msk[land+nx2+1]+msk[land+nx2-1] $ 171 +msk[land-nx2+1]+msk[land-nx2-1]) 172 ENDCASE 155 173 ; list all the points that have sea neighbors 156 174 ok = where(weight GT 0) … … 164 182 z = temporary(z)*msk 165 183 ; 166 zcoast = z[1+coast]+z[-1+coast]+z[nx2+coast]+z[-nx2+coast] $ 184 CASE 1 OF 185 keyword_set(fillxdir):zcoast = z[1+coast]+z[-1+coast] 186 keyword_set(fillydir):zcoast = z[nx2+coast]+z[-nx2+coast] 187 ELSE:zcoast = z[1+coast]+z[-1+coast]+z[nx2+coast]+z[-nx2+coast] $ 167 188 +1./sqrt(2)*(z[nx2+1+coast]+z[nx2-1+coast] $ 168 189 +z[-nx2+1+coast]+z[-nx2-1+coast]) 190 ENDCASE 169 191 ; 170 192 IF keyword_set(ge0) THEN zcoast = 0. > temporary(zcoast) … … 192 214 ; find the land points 193 215 land = where(msk EQ 0, cnt_land) 216 IF keyword_set(fillxdir) THEN BEGIN 217 tst = total(msk[1:nx, 1:ny], 1) 218 cnt_land = total(tst NE 0 AND tst NE nx) 219 ENDIF 220 IF keyword_set(fillydir) THEN BEGIN 221 tst = total(msk[1:nx, 1:ny], 2) 222 cnt_land = total(tst NE 0 AND tst NE ny) 223 ENDIF 194 224 ; 195 225 ENDWHILE
Note: See TracChangeset
for help on using the changeset viewer.