- Timestamp:
- Nov 18, 2011, 1:51:41 PM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/mymath.py
r395 r398 2 2 import numpy as np 3 3 if field is None: return None 4 if type(field).__name__=='MaskedArray': 5 field.set_fill_value(np.NaN) 6 return np.ma.array(field).min(axis=axis) 7 elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')): 8 return np.ma.masked_invalid(field).min(axis=axis) 4 9 else: return np.array(field).min(axis=axis) 5 10 … … 7 12 import numpy as np 8 13 if field is None: return None 14 if type(field).__name__=='MaskedArray': 15 field.set_fill_value(np.NaN) 16 return np.ma.array(field).max(axis=axis) 17 elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')): 18 return np.ma.masked_invalid(field).max(axis=axis) 9 19 else: return np.array(field).max(axis=axis) 10 20 … … 16 26 field.set_fill_value(np.NaN) 17 27 zout=np.ma.array(field).mean(axis=axis) 18 # np.ma.masked_invalid(zout)19 28 zout.set_fill_value(np.NaN) 29 return zout.filled() 30 elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')): 31 zout=np.ma.masked_invalid(field).mean(axis=axis) 32 zout.set_fill_value([np.NaN]) 20 33 return zout.filled() 21 34 else: -
trunk/UTIL/PYTHON/myplot.py
r396 r398 488 488 meanlat = 0.5*(wlat[0]+wlat[1]) 489 489 if blat is None: 490 ortholat=meanlat 490 491 if wlat[0] >= 80.: blat = 40. 491 492 elif wlat[1] <= -80.: blat = -40. 492 493 elif wlat[1] >= 0.: blat = wlat[0] 493 494 elif wlat[0] <= 0.: blat = wlat[1] 495 else: ortholat=blat 494 496 #print "blat ", blat 495 497 h = 50. ## en km … … 498 500 llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1]) 499 501 elif char == "moll": m = Basemap(rsphere=radius,projection='moll',lon_0=meanlon) 500 elif char == "ortho": m = Basemap(rsphere=radius,projection='ortho',lon_0=meanlon,lat_0= meanlat)502 elif char == "ortho": m = Basemap(rsphere=radius,projection='ortho',lon_0=meanlon,lat_0=ortholat) 501 503 elif char == "lcc": m = Basemap(rsphere=radius,projection='lcc',lat_1=meanlat,lat_0=meanlat,lon_0=meanlon,\ 502 504 llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1]) … … 605 607 "T_NADIR_DAY": "%.0f",\ 606 608 "T_NADIR_NIT": "%.0f",\ 609 "TEMP_DAY": "%.0f",\ 610 "TEMP_NIGHT": "%.0f",\ 607 611 "tpot": "%.0f",\ 608 612 "TSURF": "%.0f",\ -
trunk/UTIL/PYTHON/planetoplot.py
r395 r398 178 178 179 179 ##### SPECIFIC 180 if varname in ["temp","t","T_nadir_nit","T_nadir_day" ] and tsat:180 if varname in ["temp","t","T_nadir_nit","T_nadir_day","temp_day","temp_night"] and tsat: 181 181 tt=getfield(nc,varname) ; print "computing Tsat-T, I ASSUME Z-AXIS IS PRESSURE" 182 182 if type(tt).__name__=='MaskedArray': tt.set_fill_value([np.NaN]) ; tinput=tt.filled() … … 329 329 zevmin, zevmax = calculate_bounds(what_I_plot,vmin=vmin,vmax=vmax) 330 330 if colorb in ["def","nobar"]: palette = get_cmap(name=defcolorb(fvar.upper())) 331 elif (fileref is not None) and (index_f is numplot-1): palette = get_cmap(name="RdBu_r") 331 332 else: palette = get_cmap(name=colorb) 332 333 ##### 2D field … … 357 358 if colorb != 'nobar' and varname != 'HGT' : 358 359 if (fileref is not None) and (index_f is numplot-1): 359 colorbar(fraction=0.05,pad=0.03,format="%. 2f",\360 colorbar(fraction=0.05,pad=0.03,format="%.3f",\ 360 361 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,20])),\ 361 362 extend='neither',spacing='proportional')
Note: See TracChangeset
for help on using the changeset viewer.