- Timestamp:
- Oct 27, 2016, 10:37:16 AM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.py
r1227 r1238 914 914 otrackf.close() 915 915 916 quit(-1) 916 917 # Joining variable files 917 918 if not os.path.isfile(fileon): … … 1158 1159 # pinterp: pressure interpolation (to the given $plevels) 1159 1160 vals=plevels + ',1,1' 1161 print fname + '; Lluis vals:', vals, 'plevels:', plevels 1160 1162 if dofile: 1161 1163 try: … … 3807 3809 op = vnop.split('_')[1] 3808 3810 values = allcompvar[vnop] 3809 print fname + ': Lluis first values:', values3810 3811 VnOpS = varnoper(vn, op, opersurnames) 3811 3812 … … 4393 4394 if addfiles: 4394 4395 if dbg: 4395 print ' ' + main + ": adding variables to co pmute removing " + \4396 print ' ' + main + ": adding variables to compute removing " + \ 4396 4397 "file '" + varcompf + "' ..." 4397 4398 sub.call('rm ' + varcompf +' >& /dev/null', shell=True) … … 4410 4411 sout = sub.call(ins, shell=True) 4411 4412 files1h = gen.files_folder(iwdir,fh) 4413 print sub.call('ls ' + iwdir + '/' + fh + '*', shell=True) 4414 print main + '; Lluis file1h:', files1h, 'iwdir:', iwdir, 'fh:', fh 4412 4415 if len(files1h) < 1: 4413 4416 print errmsg -
trunk/tools/nc_var_tools.py
r1237 r1238 17078 17078 ovar2 = onc.variables['PB'] 17079 17079 17080 pres = (ovar1[:] + ovar2[:]).astype('float64') 17080 pres0 = ovar1[:] + ovar2[:] 17081 pres = pres0.astype('float64') 17081 17082 17082 17083 dimx = pres.shape[3] … … 17171 17172 # temperature 17172 17173 if modname == 'WRF': 17173 Rd = 287.04 17174 Cp = 7.*Rd/2. 17175 RCP = Rd/Cp 17176 p0 = 100000. 17177 ovar1 = onc.variables['T'] 17178 temp = ((ovar1[:]+300.)*(pres[:]/p0)**RCP).astype('float64') 17174 Rd = np.float64(287.04) 17175 Cp = np.float64(7.*Rd/2.) 17176 RCP = np.float64(Rd/Cp) 17177 p0 = np.float64(100000.) 17178 ovar10 = onc.variables['T'] 17179 var10 = ovar10[:] 17180 ovar1 = (var10).astype('float64') 17181 temp0 = (ovar1[:]+300.)*(pres[:]/p0)**RCP 17182 temp = temp0.astype('float64') 17179 17183 elif modname == 'LMDZ' or modname == 'cfLMDZ': 17180 17184 ovar1 = onc.variables['temp'] … … 17226 17230 # Creation of pressure variable dimension 17227 17231 newvar = onewnc.createVariable('pres', 'f8', ('pres')) 17228 newvar[:] = interplevs 17232 newvar[:] = interplevs[:] 17229 17233 basicvardef(newvar, 'pressure', 'Pressure', 'Pa') 17230 17234 attr = set_attribute(newvar, 'positive', 'down') … … 17295 17299 newvarattr[attrn] = attrv 17296 17300 17301 print fname + '; Lluis varin shape:', varin.shape 17297 17302 if varin is not None: 17298 17303 varint = varin.transpose() … … 17303 17308 qvt = qv.transpose() 17304 17309 17310 print fname + '; Lluis going to the subroutine....' 17311 print fname + '; Lluis shapes: varint:', varint.shape,'prest:',prest.shape,'psfct:',psfct.shape,\ 17312 'hgtt:', hgtt.shape,'tempt:',tempt.shape,'qvt:',qvt.shape 17305 17313 varinterp = fin.module_forinterpolate.interp( data_in=varint, \ 17306 17314 pres_field=prest, interp_levels=interplevs, psfc=psfct, \ 17307 17315 ter=hgtt, tk=tempt, qv=qvt, linlog=linloginterp, \ 17308 extrapolate=extrap, geopt=isgeop, missing=gen.fillValueF) 17316 extrapolate=extrap, geopt=isgeop, missing=gen.fillValueF, ix=dimx, \ 17317 iy=dimy, iz=dimz, it=dimt, num_metgrid_levels=len(interplevs)) 17318 print fname + '; Lluis after the subroutine' 17309 17319 17310 17320 newvar = onewnc.createVariable(CFvn, 'f4', tuple(newMODdims), \
Note: See TracChangeset
for help on using the changeset viewer.