Changeset 2222 in lmdz_wrf
- Timestamp:
- Nov 8, 2018, 10:59:59 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diagnostics.py
r2215 r2222 101 101 102 102 # Variables not to check 103 NONcheckingvars = ['accum', 'cllmh', 'deaccum', 'face', ' TSrhs',\103 NONcheckingvars = ['accum', 'cllmh', 'deaccum', 'face', 'LONLATdxdy', 'TSrhs', \ 104 104 'TStd', 'TSwds', 'TSwss', \ 105 105 'WRFbils', \ … … 167 167 WRFz_compute = False 168 168 WRFdxdy_compute = False 169 LONLATdxdy_compute = False 169 170 170 171 # File creation … … 192 193 if dnv == 'WRFz':WRFz_compute = True 193 194 if dnv == 'WRFdxdy':WRFdxdy_compute = True 195 if dnv == 'LONLATdxdy':LONLATdxdy_compute = True 194 196 195 197 # diagnostics to compute … … 221 223 if gen.searchInlist(depvars, 'WRFz'): WRFz_compute = True 222 224 if gen.searchInlist(depvars, 'WRFdxdy'): WRFdxdy_compute = True 225 if gen.searchInlist(depvars, 'LONLATdxdy'): LONLATdxdy_compute = True 223 226 224 227 # Dictionary with the new computed variables to be able to add them … … 422 425 WRFdx[:,0:dimx-1]=(WRFlon[:,1:dimx]-WRFlon[:,0:dimx-1])*DX/WRFmapfac_m[:,0:dimx-1] 423 426 WRFdy[0:dimy-1,:]=(WRFlat[1:dimy,:]-WRFlat[0:dimy-1,:])*DY/WRFmapfac_m[0:dimy-1,:] 427 WRFds = np.sqrt(WRFdx**2 + WRFdy**2) 428 429 # Attributes of the variable 430 Vvals = gen.variables_values('WRFdx') 431 dictcompvars['WRFdx'] = {'name': Vvals[0], 'standard_name': Vvals[1], \ 432 'long_name': Vvals[4].replace('|',' '), 'units': Vvals[5]} 433 Vvals = gen.variables_values('WRFdy') 434 dictcompvars['WRFdy'] = {'name': Vvals[0], 'standard_name': Vvals[1], \ 435 'long_name': Vvals[4].replace('|',' '), 'units': Vvals[5]} 436 Vvals = gen.variables_values('WRFds') 437 dictcompvars['WRFds'] = {'name': Vvals[0], 'standard_name': Vvals[1], \ 438 'long_name': Vvals[4].replace('|',' '), 'units': Vvals[5]} 439 440 if LONLATdxdy_compute: 441 print ' ' + main + ': Retrieving dxdy: real distance between grid points ' + \ 442 'from a regular lonlat projection as dx=(lon[i+1]-lon[i])*raddeg*Rearth*' + \ 443 'cos(abs(lat[i])); dy=(lat[j+1]-lat[i])*raddeg*Rearth; ds=sqrt(dx**2+dy**2); '+\ 444 'raddeg = pi/180; Rearth=6370.0e03' 445 dimv = ncobj.variables['lon'].shape 446 lon = ncobj.variables['lon'][:] 447 lat = ncobj.variables['lat'][:] 448 449 WRFlon, WRFlat = gen.lonlat2D(lon,lat) 450 451 dimx = WRFlon.shape[1] 452 dimy = WRFlon.shape[0] 453 454 WRFdx = np.zeros((dimy,dimx), dtype=np.float) 455 WRFdy = np.zeros((dimy,dimx), dtype=np.float) 456 457 raddeg = np.pi/180. 458 459 Rearth = fdef.module_definitions.earthradii 460 461 WRFdx[:,0:dimx-1]=(WRFlon[:,1:dimx]-WRFlon[:,0:dimx-1])*raddeg*Rearth* \ 462 np.cos(np.abs(WRFlat[:,0:dimx-1]*raddeg)) 463 WRFdy[0:dimy-1,:]=(WRFlat[1:dimy,:]-WRFlat[0:dimy-1,:])*raddeg*Rearth 424 464 WRFds = np.sqrt(WRFdx**2 + WRFdy**2) 425 465 … … 728 768 hvalleyrange = np.float(depvars[4].split(':')[4]) 729 769 730 dnamesvar = list(ncobj.variables[depvars[ 0]].dimensions)770 dnamesvar = list(ncobj.variables[depvars[2]].dimensions) 731 771 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 732 772 lon, lat = gen.lonlat2D(var0, var1) … … 760 800 761 801 ncvar.insert_variable(ncobj, 'orogmax', rngorogmax, diagoutd, diagoutvd, \ 762 newnc )802 newnc, fill=gen.fillValueF) 763 803 newnc.renameVariable('orogmax', 'rangeorogmax') 764 804 ovar = newnc.variables['rangeorogmax']
Note: See TracChangeset
for help on using the changeset viewer.