Changeset 395
- Timestamp:
- Nov 17, 2011, 1:08:01 PM (14 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/make_netcdf.py
r379 r395 89 89 zvarcarac[zznames[i]]=zzvardim 90 90 i=i+1 91 92 print "creating "+zfilename 93 91 94 print zvarcarac 92 95 … … 139 142 file.close() 140 143 144 print "closing "+zfilename 145 146 return 147 141 148 def find_key(dic, val): 142 149 """return the key of dictionary dic given the value""" -
trunk/UTIL/PYTHON/mymath.py
r391 r395 112 112 m=np.ma.masked_invalid(temp,copy=False) 113 113 zoutput=np.ma.array(output,mask=m.mask,fill_value=np.NaN) 114 # zout=zoutput.filled()115 114 return zoutput 116 115 -
trunk/UTIL/PYTHON/myplot.py
r392 r395 49 49 def getfield (nc,var): 50 50 ## this allows to get much faster (than simply referring to nc.variables[var]) 51 import numpy as np 51 52 dimension = len(nc.variables[var].dimensions) 52 53 #print " Opening variable with", dimension, "dimensions ..." … … 54 55 elif dimension == 3: field = nc.variables[var][:,:,:] 55 56 elif dimension == 4: field = nc.variables[var][:,:,:,:] 56 return field 57 # if there are NaNs in the ncdf, they should be loaded as a masked array which will be 58 # recasted as a regular array later in reducefield 59 if (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')): 60 print "Warning: netcdf as nan values but is not loaded as a Masked Array." 61 print "recasting array type" 62 out=np.ma.masked_invalid(field) 63 out.set_fill_value([np.NaN]) 64 else: 65 out=field 66 return out 57 67 58 68 ## Author: AS + TN + AC … … 492 502 llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1]) 493 503 elif char == "npstere": m = Basemap(rsphere=radius,projection='npstere', boundinglat=blat, lon_0=0.) 494 elif char == "spstere": m = Basemap(rsphere=radius,projection='spstere', boundinglat=blat, lon_0= 0.)504 elif char == "spstere": m = Basemap(rsphere=radius,projection='spstere', boundinglat=blat, lon_0=180.) 495 505 elif char == "nplaea": m = Basemap(rsphere=radius,projection='nplaea', boundinglat=wlat[0], lon_0=meanlon) 496 506 elif char == "laea": m = Basemap(rsphere=radius,projection='laea',lon_0=meanlon,lat_0=meanlat,lat_ts=meanlat,\ -
trunk/UTIL/PYTHON/planetoplot.py
r393 r395 183 183 else: tinput=tt 184 184 all_var[k]=get_tsat(vert,tinput,zlon=lon,zlat=lat,zalt=vert,ztime=time) 185 all_varname[k] = varname 185 186 else: 186 187 ##### GENERAL STUFF HERE
Note: See TracChangeset
for help on using the changeset viewer.