Changeset 909 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 20, 2016, 1:12:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r907 r909 15987 15987 newWRFdims = ['Time', 'pres', 'south_north', 'west_east'] 15988 15988 notCHK = ['WRFght', 'WRFt', 'WRFrh'] 15989 CFdims = ['time', 'pres', 'lat', 'lon'] 15989 15990 15990 15991 varns = gen.str_list(variables, ',') … … 16009 16010 # looking for WRF required variables 16010 16011 WRFvarrequired = ['P', 'PB', 'PSFC', 'PH', 'PHB', 'HGT', 'T', 'QVAPOR', 'XLONG', \ 16011 'XLAT', 'Times' , 'P_TOP']16012 'XLAT', 'Times'] 16012 16013 for var in WRFvarrequired: 16013 16014 if not gen.searchInlist(onc.variables, var): … … 16058 16059 temp = ((ovar1[:]+300.)*(pres[:]/p0)**RCP).astype('float64') 16059 16060 16061 WRFdimvs = {'Time':dimt, 'bottom_top':dimz, 'south_north':dimy, 'west_east': dimx} 16062 16060 16063 onewnc = NetCDFFile(ofile, 'w') 16061 16064 # Creation of dimensions … … 16070 16073 ovar = onc.variables[var] 16071 16074 varinf = variable_inf(ovar) 16075 newvard = [] 16072 16076 for vd in varinf.dimns: 16073 if not gen.searchInlist(onewnc.dimensions, vd): 16077 if not gen.searchInlist(onewnc.dimensions, vd) and \ 16078 not gen.searchInlist(CFdims, vd): 16074 16079 newdim = onewnc.createDimension(vd, len(onc.dimensions[vd])) 16080 if gen.searchInlist(CFdims,vd): 16081 icfdim = CFdims.index(vd) 16082 newvard.append(WRFdims[icfdim]) 16083 else: 16084 newvard.append(vd) 16085 16075 16086 newvar = onewnc.createVariable(var, nctype(varinf.dtype), \ 16076 tuple( varinf.dimns))16087 tuple(newvard)) 16077 16088 newvar[:] = ovar[:] 16078 16089 for attrn in ovar.ncattrs(): … … 16126 16137 varinf = variable_inf(ovarin) 16127 16138 varin = ovarin[:] 16139 # de-staggering 16140 if gen.searchInlist(ovarin.dimensions, 'west_east'): 16141 varint = gen.stagger_unstagger(varin,list(ovarin.dimensions),WRFdimvs) 16142 else: 16143 CFdimvs = {'time': dimt, 'bottom_top': dimz, 'lat': dimy, 'lon': dimx} 16144 varint = gen.stagger_unstagger(varin,list(ovarin.dimensions),CFdimvs) 16128 16145 isgeop = False 16146 if vn == 'z': isgeop = True 16129 16147 varattrs = gen.variables_values(vn) 16130 16148 CFvn = varattrs[0] … … 16143 16161 tempt = temp.transpose() 16144 16162 qvt = qv.transpose() 16163 print fname + ' Lluis shapes varint:', varint.shape, 'prest:', prest.shape, \ 16164 'psfct:', psfct.shape, 'hgtt:', hgtt.shape,' tempt:', tempt.shape, 'qvt:',qvt.shape 16145 16165 varinterp = fin.module_forinterpolate.interp( data_in=varint, \ 16146 16166 pres_field=prest, interp_levels=interplevs, psfc=psfct, \
Note: See TracChangeset
for help on using the changeset viewer.