Changeset 338 in lmdz_wrf for trunk/tools/validation_sim.py
- Timestamp:
- Feb 28, 2015, 6:11:34 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/validation_sim.py
r337 r338 2 2 # L. Fita, LMD-Jussieu. February 2015 3 3 ## e.g. sfcEneAvigon # validation_sim.py -d X@west_east@None,Y@south_north@None,T@Time@time -D X@XLONG@longitude,Y@XLAT@latitude,T@time@time -k single-station -l 4.878773,43.915876,12. -o /home/lluis/DATA/obs/HyMeX/IOP15/sfcEnergyBalance_Avignon/OBSnetcdf.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v HFX@H,LH@LE,GRDFLX@G 4 ## e.g. AIREP # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@time -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@alti,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/AIREP/2012/10/AIREP_121018.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRF T@t4 ## e.g. AIREP # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@time -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@alti,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/AIREP/2012/10/AIREP_121018.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFt@t 5 5 ## e.g. ATRCore # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@CFtime -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@altitude,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/ATRCore/V3/ATR_1Hz-HYMEXBDD-SOP1-v3_20121018_as120051.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFT@air_temperature@subc@273.15 6 6 ## e.g. BAMED # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@CFtime -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@altitude,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/BAMED/BAMED_SOP1_B12_TOT5.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFT@tas_north … … 664 664 quit(-1) 665 665 666 print type(ncobj.variables)667 668 666 self.dimensions = dimensions 669 667 self.shape = shape … … 672 670 def __getitem__(self,elem): 673 671 return self.__values[elem] 674 675 672 676 673 ####### ###### ##### #### ### ## # … … 956 953 stationpos[0] = stsimpos[iid] 957 954 iid = iid + 1 958 if stationpos[0] == 0 andstationpos[1] == 0: notfound[it] = 1955 if stationpos[0] == 0 or stationpos[1] == 0: notfound[it] = 1 959 956 960 957 trajpos[0,it] = stationspos[0] … … 1105 1102 if dims.has_key('Z'): 1106 1103 for it in range(Ncoindt): 1107 i f notfound[it] == 0:1108 ito = int(coindtvalues[it,1])1109 trajpos[2,ito] = index_mat(valdimsim['Z'][ it,:,trajpos[1,ito],\1110 trajpos[0,ito]], valdimobs['Z'][ito])1104 ito = int(coindtvalues[it,1]) 1105 if notfound[ito] == 0: 1106 trajpos[2,ito] = index_mat(valdimsim['Z'][coindtvalues[it,0],:, \ 1107 trajpos[1,ito],trajpos[0,ito]], valdimobs['Z'][ito]) 1111 1108 slicev = dims['X'][0]+':'+str(trajpos[0,ito]) + '|' + \ 1112 1109 dims['Y'][0]+':'+str(trajpos[1,ito]) + '|' + \ … … 1115 1112 slicevar, dimslice = slice_variable(ovsim, slicev) 1116 1113 simobsvalues.append([ slicevar, ovobs[int(ito)]]) 1117 slicev = dims['X'][0] + ':' + str(trajpos[0,ito]-Ngrid) + '@' + \ 1118 str(trajpos[0,ito]+Ngrid+1) + '|' + dims['Y'][0] + ':' + \ 1119 str(trajpos[1,ito]-Ngrid) + '@' + str(trajpos[1,ito]+Ngrid+1)+ \ 1120 '|' + dims['Z'][0] + ':' + str(trajpos[2,ito]-Ngrid) + '@' + \ 1121 str(trajpos[2,ito]+Ngrid+1) + '|' + dims['T'][0] + ':' + \ 1122 str(int(coindtvalues[it,0])) 1114 minx = np.max([trajpos[0,ito]-Ngrid,0]) 1115 maxx = np.min([trajpos[0,ito]+Ngrid+1,ovsim.shape[3]]) 1116 miny = np.max([trajpos[1,ito]-Ngrid,0]) 1117 maxy = np.min([trajpos[1,ito]+Ngrid+1,ovsim.shape[2]]) 1118 minz = np.max([trajpos[2,ito]-Ngrid,0]) 1119 maxz = np.min([trajpos[2,ito]+Ngrid+1,ovsim.shape[1]]) 1120 1121 slicev = dims['X'][0] + ':' + str(minx) + '@' + str(maxx) + '|' +\ 1122 dims['Y'][0] + ':' + str(miny) + '@' + str(maxy) + '|' + \ 1123 dims['Z'][0] + ':' + str(minz) + '@' + str(maxz) + '|' + \ 1124 dims['T'][0] + ':' + str(int(coindtvalues[it,0])) 1123 1125 slicevar, dimslice = slice_variable(ovsim, slicev) 1124 simobsSvalues[it,:,:,:] = slicevar 1126 1127 sliceS = [] 1128 sliceS.append(it) 1129 sliceS.append(slice(0,maxz-minz)) 1130 sliceS.append(slice(0,maxy-miny)) 1131 sliceS.append(slice(0,maxx-minx)) 1132 1133 simobsSvalues[tuple(sliceS)] = slicevar 1125 1134 if ivar == 0: 1126 1135 trjsim[0,it] = trajpos[0,ito] … … 1174 1183 if dims.has_key('Z'): 1175 1184 newdim = onewnc.createDimension('zaround',Ngrid*2+1) 1176 newvar = onewnc.createVariable( 1185 newvar = onewnc.createVariable(valvars[ivar][0] + 'around', 'f', \ 1177 1186 ('time','zaround','yaround','xaround'), fill_value=fillValueF) 1178 1187 else: 1179 newvar = onewnc.createVariable( 1188 newvar = onewnc.createVariable(valvars[ivar][0] + 'around', 'f', \ 1180 1189 ('time','yaround','xaround'), fill_value=fillValueF) 1181 1190 … … 1185 1194 1186 1195 # Statistics 1187 newvar = onewnc.createVariable(va rsimobs + 'staround', 'f', ('time','stats'),\1188 fill_value=fillValueF)1196 newvar = onewnc.createVariable(valvars[ivar][0] + 'staround', 'f', \ 1197 ('time','stats'), fill_value=fillValueF) 1189 1198 descvar = 'around simulated statisitcs: ' + valvars[ivar][0] 1190 1199 basicvardef(newvar, varsimobs + 'staround', descvar, ovobs.getncattr('units'))
Note: See TracChangeset
for help on using the changeset viewer.