Changeset 1777 in lmdz_wrf for trunk/tools/diagnostics.py
- Timestamp:
- Feb 16, 2018, 3:17:02 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diagnostics.py
r1776 r1777 6 6 # ciclad: f2py --f90flags="-fPIC" --f90exec=/usr/bin/gfortran -L/opt/canopy-1.3.0/Canopy_64bit/System/lib/ -L/usr/lib64/ -L/opt/canopy-1.3.0/Canopy_64bit/System/lib/ -m module_ForDiagnostics -c module_generic.F90 module_ForDiagnosticsVars.F90 module_ForDiagnostics.F90 >& run_f2py.log 7 7 8 ## e.g. # diagnostics.py -d 'Time@ time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' -v 'clt|CLDFRA,cllmh|CLDFRA@WRFp,RAINTOT|RAINC@RAINNC@XTIME' -f WRF_LMDZ/NPv31/wrfout_d01_1980-03-01_00:00:008 ## e.g. # diagnostics.py -d 'Time@WRFtime,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' -v 'clt|CLDFRA,cllmh|CLDFRA@WRFp,RAINTOT|RAINC@RAINNC@XTIME' -f WRF_LMDZ/NPv31/wrfout_d01_1980-03-01_00:00:00 9 9 ## e.g. # diagnostics.py -f /home/lluis/PY/diagnostics.inf -d variable_combo -v WRFprc 10 10 … … 90 90 'WRFp', 'WRFtd', \ 91 91 'WRFpos', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs', 'WRFrhs', 'WRFrvors', \ 92 'WRFt', 'WRFtime', 'WRFua', 'WRFva', 'WRFwds', 'WRFwss', 'WRFheight' ]92 'WRFt', 'WRFtime', 'WRFua', 'WRFva', 'WRFwds', 'WRFwss', 'WRFheight', 'WRFz'] 93 93 94 94 NONchkvardims = ['WRFtime'] … … 124 124 WRFpos_compute = False 125 125 WRFtime_compute = False 126 WRFz_compute = False 126 127 127 128 # File creation … … 147 148 if dnv == 'WRFpos': WRFpos_compute = True 148 149 if dnv == 'WRFtime': WRFtime_compute = True 150 if dnv == 'WRFz':WRFz_compute = True 149 151 150 152 # diagnostics to compute … … 163 165 if depvars == 'WRFpos': WRFpos_compute = True 164 166 if depvars == 'WRFtime': WRFtime_compute = True 167 if depvars == 'WRFz': WRFz_compute = True 165 168 else: 166 169 depvars = diags[idiag].split('|')[1].split('@') … … 173 176 if gen.searchInlist(depvars, 'WRFpos'): WRFpos_compute = True 174 177 if gen.searchInlist(depvars, 'WRFtime'): WRFtime_compute = True 178 if gen.searchInlist(depvars, 'WRFz'): WRFz_compute = True 175 179 176 180 # Dictionary with the new computed variables to be able to add them … … 325 329 dictcompvars['WRFtime'] = {'name': 'time', 'standard_name': 'time', \ 326 330 'long_name': 'time', 'units': tunits, 'calendar': 'gregorian'} 331 332 if WRFz_compute: 333 print ' ' + main + ': Retrieving z: height above surface value from WRF as ' + \ 334 'unstagger(PH + PHB)/9.8-hgt' 335 dimv = ncobj.variables['PH'].shape 336 WRFzg = (ncobj.variables['PH'][:] + ncobj.variables['PHB'][:])/9.8 337 338 unzgd = (dimv[0], dimv[1]-1, dimv[2], dimv[3]) 339 unzg = np.zeros(unzgd, dtype=np.float) 340 unzg = 0.5*(WRFzg[:,0:dimv[1]-1,:,:] + WRFzg[:,1:dimv[1],:,:]) 341 342 WRFz = np.zeros(unzgd, dtype=np.float) 343 for iz in range(dimv[1]-1): 344 WRFz[:,iz,:,:] = unzg[:,iz,:,:] - ncobj.variables['HGT'][:] 345 346 # Attributes of the variable 347 Vvals = gen.variables_values('WRFz') 348 dictcompvars['WRFz'] = {'name': Vvals[0], 'standard_name': Vvals[1], \ 349 'long_name': Vvals[4].replace('|',' '), 'units': Vvals[5]} 327 350 328 351 ### ## # … … 1123 1146 ncvar.insert_variable(ncobj, 'zmla', diagout, diagoutd, diagoutvd, newnc) 1124 1147 1125 # WRFzwind wind extrapolation at a given hieght computation from WRF U, V, WRF geop,1126 # U10, V10, HGT,SINALPHA, COSALPHA, z=[zval]1148 # WRFzwind wind extrapolation at a given hieght computation from WRF U, V, WRFz, 1149 # U10, V10, SINALPHA, COSALPHA, z=[zval] 1127 1150 elif diagn == 'WRFzwind': 1128 1151 var0 = ncobj.variables[depvars[0]][:] 1129 1152 var1 = ncobj.variables[depvars[1]][:] 1130 dimz = var0.shape[1] 1131 var2 = WRFgeop[:,1:dimz+1,:,:]/9.8 1153 var2 = WRFz 1132 1154 var3 = ncobj.variables[depvars[3]][:] 1133 1155 var4 = ncobj.variables[depvars[4]][:] 1134 1156 var5 = ncobj.variables[depvars[5]][0,:,:] 1135 1157 var6 = ncobj.variables[depvars[6]][0,:,:] 1136 var7 = ncobj.variables[depvars[7]][0,:,:] 1137 var8 = np.float(depvars[8].split('=')[1]) 1158 var7 = np.float(depvars[7].split('=')[1]) 1138 1159 1139 1160 # un-staggering 3D winds … … 1146 1167 1147 1168 diagout1, diagout2, diagoutd, diagoutvd = diag.Forcompute_zwind(unvar0, \ 1148 unvar1, var2, var3, var4, var5, var6, var7, var8,dnames, dvnames)1169 unvar1, var2, var3, var4, var5, var6, var7, dnames, dvnames) 1149 1170 1150 1171 # Removing the nonChecking variable-dimensions from the initial list
Note: See TracChangeset
for help on using the changeset viewer.