Changeset 252 for trunk/MESOSCALE_DEV/PLOT
- Timestamp:
- Aug 2, 2011, 1:48:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/myplot.py
r247 r252 1 def errormess(text ):1 def errormess(text,printvar=None): 2 2 print text 3 if printvar: print printvar 3 4 exit() 4 5 return 6 7 def getname(var=False,winds=False,anomaly=False): 8 if var and winds: basename = var + '_UV' 9 elif var: basename = var 10 elif winds: basename = 'UV' 11 else: errormess("please set at least winds or var",printvar=nc.variables) 12 if anomaly: basename = 'd' + basename 13 return basename 14 15 def localtime(utc,lon): 16 ltst = utc + lon / 15. 17 ltst = int (ltst * 10) / 10. 18 ltst = ltst % 24 19 return ltst 5 20 6 21 def whatkindfile (nc): … … 21 36 22 37 def reducefield (input,d4=None,d3=None,d2=None,d1=None): 23 ### do it the reverse way to be compliant with netcdf "t z y x" or "t y x" or "y x"38 ### we do it the reverse way to be compliant with netcdf "t z y x" or "t y x" or "y x" 24 39 ### it would be actually better to name d4 d3 d2 d1 as t z y x 25 40 import numpy as np … … 71 86 return output, error 72 87 73 #def latinterv (area):74 # if area == "Europe": [wlat,wlon] = [[ 20., 80.],[- 50., 50.]]75 # elif area == "Central_America": [wlat,wlon] = [[-10., 40.],[ 230., 300.]]76 # elif area == "Africa": [wlat,wlon] = [[-20., 50.],[- 50., 50.]]77 # elif area == "Whole": [wlat,wlon] = [[-90., 90.],[-180.,-180.]]78 # elif area == "Southern_Hemisphere": [wlat,wlon] = [[-90., 60.],[-180.,-180.]]79 # elif area == "Northern_Hemisphere": [wlat,wlon] = [[-60., 90.],[-180.,-180.]]80 # elif area == "Tharsis": [wlat,wlon] = [[-30., 60.],[-170.,- 10.]]81 # elif area == "Whole_No_High": [wlat,wlon] = [[-60., 60.],[-180., 180.]]82 # elif area == "Chryse": [wlat,wlon] = [[-60., 60.],[- 60., 60.]]83 # elif area == "North_Pole": [wlat,wlon] = [[ 50., 90.],[-180., 180.]]84 # elif area == "Close_North_Pole": [wlat,wlon] = [[ 75., 90.],[-180., 180.]]85 # elif area == "Far_South_Pole": [wlat,wlon] = [[-90.,-40.],[-180., 180.]]86 # elif area == "South_Pole": [wlat,wlon] = [[-90.,-50.],[-180., 180.]]87 # elif area == "Close_South_Pole": [wlat,wlon] = [[-90.,-75.],[-180., 180.]]88 # return wlon,wlat89 90 88 def definesubplot ( numplot, fig ): 91 89 from matplotlib.pyplot import rcParams … … 197 195 else: 198 196 proj="merc" 199 elif typefile in ['gcm']: proj="cyl" ## pb avec les autres (de trace derriere la sphere ?)197 elif typefile in ['gcm']: proj="cyl" ## pb avec les autres (de trace derriere la sphere ?) 200 198 else: proj="ortho" 201 199 return proj … … 205 203 title(name) 206 204 print name 205 206 def polarinterv (lon2d,lat2d): 207 import numpy as np 208 wlon = [np.min(lon2d),np.max(lon2d)] 209 ind = np.array(lat2d).shape[0] / 2 ## to get a good boundlat and to get the pole 210 wlat = [np.min(lat2d[ind,:]),np.max(lat2d[ind,:])] 211 return [wlon,wlat] 207 212 208 213 def simplinterv (lon2d,lat2d): … … 365 370 elif wlat[1] >= 0.: blat = wlat[0] 366 371 elif wlat[0] <= 0.: blat = wlat[1] 367 print blat372 print "blat ", blat 368 373 h = 50. ## en km 369 374 radius = 3397200. … … 477 482 "ICETOT": "%.1e",\ 478 483 "TAU_ICE": "%.2f",\ 484 "VMR_ICE": "%.1e",\ 485 "MTOT": "%.0f",\ 479 486 "anomaly": "%.1f",\ 480 487 "W": "%.1f",\ … … 495 502 "HFX": "RdYlBu",\ 496 503 "ICETOT": "YlGnBu",\ 504 "MTOT": "PuBu",\ 497 505 "TAU_ICE": "Blues",\ 506 "VMR_ICE": "Blues",\ 498 507 "W": "jet",\ 499 508 "anomaly": "RdBu_r",\
Note: See TracChangeset
for help on using the changeset viewer.