Changeset 1021 in lmdz_wrf for trunk/tools/nc_var_tools.py
- Timestamp:
- Aug 15, 2016, 2:37:52 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1019 r1021 10056 10056 """ Function to add a CF-convention longitude/latitude variables in a WRF file 10057 10057 WRF_CFlon_creation(values, ncfile, varn) 10058 [values]= [lonname],[latname] names of the variables to add (standard names 10059 'longitude', 'latitude') 10058 [values]= [lonname],[latname],[chdimname] 10059 [lonname],[latname]: names of the variables to add (standard names 'longitude', 'latitude') 10060 [chdimname]: whether west_east, south_north dimensions should change names to 'lon','lat' 10060 10061 [ncfile]= WRF file to add the CF-convention time variable 10061 10062 [varn]= [lonname],[latname] name of the variables to use … … 10070 10071 cflonn = values.split(',')[0] 10071 10072 cflatn = values.split(',')[1] 10073 chdimn = gen.Str_Bool(values.split(',')[2]) 10072 10074 10073 10075 wlonn = varn.split(',')[0] … … 10137 10139 10138 10140 # Creation of CF-dimensions 10139 if not wrfnc.dimensions.has_key('lon'): 10140 newdim = wrfnc.createDimension('lon', dimx) 10141 if not wrfnc.dimensions.has_key('lat'): 10142 newdim = wrfnc.createDimension('lat', dimy) 10141 if chdimn: 10142 wrfnc.renameDimension('west_east', 'lon') 10143 wrfnc.renameDimension('south_north', 'lat') 10144 else: 10145 if not wrfnc.dimensions.has_key('lon'): 10146 newdim = wrfnc.createDimension('lon', dimx) 10147 if not wrfnc.dimensions.has_key('lat'): 10148 newdim = wrfnc.createDimension('lat', dimy) 10143 10149 10144 10150 if wrfnc.variables.has_key(cflonn): … … 16258 16264 # Creation of pressure variable dimension 16259 16265 newvar = onewnc.createVariable('pres', 'f8', ('pres')) 16260 newvar[:] = interplevs * 100.16266 newvar[:] = interplevs 16261 16267 basicvardef(newvar, 'pressure', 'Pressure', 'Pa') 16262 16268 attr = set_attribute(newvar, 'positive', 'down') … … 16478 16484 16479 16485 # CFing lon,lat 16480 WRF_CFlonlat_creation('lon,lat ', ncfile, wrfvl+','+wrfvL)16486 WRF_CFlonlat_creation('lon,lat,true', ncfile, wrfvl+','+wrfvL) 16481 16487 16482 16488 ncf = NetCDFFile(ncfile,'a')
Note: See TracChangeset
for help on using the changeset viewer.