- Timestamp:
- Mar 29, 2017, 9:55:16 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1472 r1474 6294 6294 quit(-1) 6295 6295 6296 malon = ma.masked_outside(lonv,lonSW,lonNE) 6297 malat = ma.masked_outside(latv,latSW,latNE) 6296 if lonSW < lonNE: 6297 malon = ma.masked_outside(lonv,lonSW,lonNE) 6298 else: 6299 malon = ma.masked_outside(lonv,lonNE,lonSW) 6300 6301 if latSW < latNE: 6302 malat = ma.masked_outside(latv,latSW,latNE) 6303 else: 6304 malat = ma.masked_outside(latv,latNE,latSW) 6298 6305 6299 6306 if len(lonobj.shape) == 1: … … 6302 6309 dimx = lonv.shape[0] 6303 6310 dimy = latv.shape[0] 6304 malonlat = malon.mask + malat.mask6305 malonv = ma.array(lonv, mask=malon lat)6306 malatv = ma.array(latv, mask=mal onlat)6311 malonlat = np.meshgrid(malon.mask,malat.mask) 6312 malonv = ma.array(lonv, mask=malon) 6313 malatv = ma.array(latv, mask=malat) 6307 6314 elif len(lonobj.shape) == 2: 6308 6315 dlonn = loninf.dimns[1] … … 6335 6342 6336 6343 print ' ' + fname + ': data box: SW', nlon, nlat,'NE:',xlon,xlat 6337 print ' ' + fname + ': name of the longitudinal dimension:', dlonn,\6338 'latitudinal:',dlatn6344 print ' ' + fname + ": name of the longitudinal dimension: '" + dlonn + \ 6345 "' latitudinal: '" + dlatn 6339 6346 6340 6347 ilon = dimx … … 6345 6352 for j in range(dimy): 6346 6353 for i in range(dimx): 6347 if malonlat [j,i] == False and i < ilon:6354 if malonlat.mask[j,i] == False and i < ilon: 6348 6355 ilon = i 6349 if malonlat [j,i] == False and i > elon:6356 if malonlat.mask[j,i] == False and i > elon: 6350 6357 elon = i 6351 if malonlat [j,i] == False and j < ilat:6358 if malonlat.mask[j,i] == False and j < ilat: 6352 6359 ilat = j 6353 if malonlat [j,i] == False and j > elat:6360 if malonlat.mask[j,i] == False and j > elat: 6354 6361 elat = j 6355 6362 else: 6356 if dimx != dimy: 6357 for i in range(dimx): 6358 if malonlat[i] == False and i < ilon: 6359 ilon = i 6360 if malonlat[i] == False and i > elon: 6361 elon = i 6362 for j in range(dimy): 6363 if malonlat[j] == False and j < ilat: 6364 ilat = j 6365 if malonlat[j] == False and j > elat: 6366 elat = i 6367 else: 6368 for i in range(dimx): 6369 if malonlat[i] == False and i < ilon: 6370 ilon = i 6371 ilat = i 6372 if malonlat[i] == False and i > elon: 6373 elon = i 6374 elat = i 6363 for i in range(dimx): 6364 if malon.mask[i] == False and i < ilon: 6365 ilon = i 6366 if malon.mask[i] == False and i > elon: 6367 elon = i 6368 for j in range(dimy): 6369 if malat.mask[j] == False and j < ilat: 6370 ilat = j 6371 if malat.mask[j] == False and j > elat: 6372 elat = j 6375 6373 6376 6374 print 'ilon elon ilat elat:', ilon, elon, ilat, elat
Note: See TracChangeset
for help on using the changeset viewer.