Changeset 505 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 16, 2015, 6:48:30 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/validation_sim.py
r503 r505 730 730 'WRFrh': relative humidty fom WRF variables 731 731 'WRFt': temperature from WRF variables 732 'WRFwds': surface wind direction from WRF variables 733 'WRFwss': surface wind speed from WRF variables 732 734 'WRFz': height from WRF variables 733 735 """ … … 790 792 varNOcheckv = (ncobj.variables['T'][:] + 300.)*(p/p0)**(2./7.) 791 793 dimensions = ncobj.variables['T'].dimensions 794 795 elif varn == 'WRFwds': 796 # print ' ' + main + ': computing surface wind direction from WRF as ATAN2(V,U) ...' 797 varNOcheckv = np.arctan2(ncobj.variables['V10'][:], ncobj.variables['U10'][:]) 798 dimensions = ncobj.variables['V10'].dimensions 799 800 elif varn == 'WRFwss': 801 # print ' ' + main + ': computing surface wind speed from WRF as SQRT(U**2 + V**2) ...' 802 varNOcheckv = np.sqrt(ncobj.variables['U10'][:]*ncobj.variables['U10'][:] + \ 803 ncobj.variables['V10'][:]*ncobj.variables['V10'][:]) 804 dimensions = ncobj.variables['U10'].dimensions 792 805 793 806 elif varn == 'WRFz': … … 812 825 'WRFp': pressure from WRF variables 813 826 'WRFrh': relative humidty fom WRF variables 827 'TSrhs': surface relative humidty fom TS variables 828 'WRFrhs': surface relative humidty fom WRF variables 814 829 'WRFT': CF-time from WRF variables 815 830 'WRFt': temperature from WRF variables 816 831 'WRFtd': dew-point temperature from WRF variables 832 'WRFwd': wind direction from WRF variables 833 'TSwds': surface wind direction from TS variables 834 'WRFwds': surface wind direction from WRF variables 817 835 'WRFws': wind speed from WRF variables 818 'WRFwd': wind direction from WRF variables 836 'TSwss': surface wind speed from TS variables 837 'WRFwss': surface wind speed from WRF variables 819 838 'WRFz': height from WRF variables 820 839 """ … … 872 891 p0=100000. 873 892 p=ncobj.variables['P'][:] + ncobj.variables['PB'][:] 874 tk = (ncobj.variables['T'][:] + 300.)*(p/p0)**(2./7.)893 tk = (ncobj.variables['T'][:])*(p/p0)**(2./7.) 875 894 qv = ncobj.variables['QVAPOR'][:] 876 895 … … 881 900 dimensions = ncobj.variables['P'].dimensions 882 901 shape = ncobj.variables['P'].shape 902 903 elif varn == 'TSrhs': 904 # print ' ' + main + ": computing surface relative humidity from TSs as 'Tetens'" +\ 905 # ' equation (T,P) ...' 906 p0=100000. 907 p=ncobj.variables['psfc'][:] 908 tk = (ncobj.variables['t'][:])*(p/p0)**(2./7.) 909 qv = ncobj.variables['q'][:] 910 911 data1 = 10.*0.6112*np.exp(17.67*(tk-273.16)/(tk-29.65)) 912 data2 = 0.622*data1/(0.01*p-(1.-0.622)*data1) 913 914 varNOcheckv = qv/data2 915 dimensions = ncobj.variables['psfc'].dimensions 916 shape = ncobj.variables['psfc'].shape 917 918 elif varn == 'WRFrhs': 919 # print ' ' + main + ": computing surface relative humidity from WRF as 'Tetens'" +\ 920 # ' equation (T,P) ...' 921 p0=100000. 922 p=ncobj.variables['PSFC'][:] 923 tk = (ncobj.variables['T2'][:] + 300.)*(p/p0)**(2./7.) 924 qv = ncobj.variables['Q2'][:] 925 926 data1 = 10.*0.6112*np.exp(17.67*(tk-273.16)/(tk-29.65)) 927 data2 = 0.622*data1/(0.01*p-(1.-0.622)*data1) 928 929 varNOcheckv = qv/data2 930 dimensions = ncobj.variables['PSFC'].dimensions 931 shape = ncobj.variables['PSFC'].shape 883 932 884 933 elif varn == 'WRFT': … … 934 983 dimensions = ncobj.variables['T'].dimensions 935 984 shape = ncobj.variables['P'].shape 985 986 elif varn == 'WRFwd': 987 # print ' ' + main + ': computing wind direction from WRF as ATAN2PI(V,U) ...' 988 uwind = ncobj.variables['U'][:] 989 vwind = ncobj.variables['V'][:] 990 dx = uwind.shape[3] 991 dy = vwind.shape[2] 992 993 # de-staggering 994 ua = 0.5*(uwind[:,:,:,0:dx-1] + uwind[:,:,:,1:dx]) 995 va = 0.5*(vwind[:,:,0:dy-1,:] + vwind[:,:,1:dy,:]) 996 997 theta = np.arctan2(ua, va) 998 dimensions = tuple(['Time','bottom_top','south_north','west_east']) 999 shape = ua.shape 1000 varNOcheckv = 360.*theta/(2.*np.pi) 1001 1002 elif varn == 'WRFwds': 1003 # print ' ' + main + ': computing surface wind direction from WRF as ATAN2(V,U) ...' 1004 theta = np.arctan2(ncobj.variables['V10'][:], ncobj.variables['U10'][:]) 1005 1006 varNOcheckv = 360.*theta/(2.*np.pi) 1007 dimensions = ncobj.variables['V10'].dimensions 1008 shape = ncobj.variables['V10'].shape 1009 1010 elif varn == 'TSwds': 1011 # print ' ' + main + ': computing surface wind direction from TSs as ATAN2(v,u) ...' 1012 theta = np.arctan2(ncobj.variables['v'][:], ncobj.variables['u'][:]) 1013 1014 varNOcheckv = 360.*theta/(2.*np.pi) 1015 dimensions = ncobj.variables['v'].dimensions 1016 shape = ncobj.variables['v'].shape 936 1017 937 1018 elif varn == 'WRFws': … … 950 1031 shape = ua.shape 951 1032 952 elif varn == ' WRFwd':953 # print ' ' + main + ': computing wind direction from WRF as ATAN2PI(V,U) ...'954 uwind = ncobj.variables['U'][:]955 vwind = ncobj.variables['V'][:]956 dx = uwind.shape[3]957 d y = vwind.shape[2]958 959 # de-staggering 960 ua = 0.5*(uwind[:,:,:,0:dx-1] + uwind[:,:,:,1:dx])961 va = 0.5*(vwind[:,:,0:dy-1,:] + vwind[:,:,1:dy,:]) 962 963 theta = np.arctan2(ua, va)964 dimensions = tuple(['Time','bottom_top','south_north','west_east'])965 shape = ua.shape966 varNOcheckv = 360.*(1. + theta/(2.*np.pi))1033 elif varn == 'TSwss': 1034 # print ' ' + main + ': computing surface wind speed from TSs as SQRT(u**2 + v**2) ...' 1035 varNOcheckv = np.sqrt(ncobj.variables['u'][:]* \ 1036 ncobj.variables['u'][:] + ncobj.variables['v'][:]* \ 1037 ncobj.variables['v'][:]) 1038 dimensions = ncobj.variables['u'].dimensions 1039 shape = ncobj.variables['u'].shape 1040 1041 elif varn == 'WRFwss': 1042 # print ' ' + main + ': computing surface wind speed from WRF as SQRT(U**2 + V**2) ...' 1043 varNOcheckv = np.sqrt(ncobj.variables['U10'][:]* \ 1044 ncobj.variables['U10'][:] + ncobj.variables['V10'][:]* \ 1045 ncobj.variables['V10'][:]) 1046 dimensions = ncobj.variables['U10'].dimensions 1047 shape = ncobj.variables['U10'].shape 967 1048 968 1049 elif varn == 'WRFz': … … 1224 1305 '[constant] to variables values; divc,[constant]: divide by [constant] to ' + \ 1225 1306 'variables values' 1226 varNOcheck = ['WRFdens', 'WRFght', 'WRFp', 'WRFrh', 'WRFT', 'WRFt', 'WRFtd', 'WRFws',\ 1227 'WRFwd', 'WRFz'] 1228 varNOcheckinf = "'WRFdens': air density from WRF variables; 'WRFght': geopotential"+ \ 1229 " height from WRF variables; 'WRFp': pressure from WRF variables; 'WRFrh': " + \ 1230 "relative humidty fom WRF variables; 'WRFT': CF-time from WRF variables'WRFt'; " + \ 1231 " temperature from WRF variables; 'WRFtd': dew-point temperature from WRF " + \ 1232 "variables; 'WRFws': wind speed from WRF variables; 'WRFwd': wind speed " + \ 1233 "direction from WRF variables; 'WRFz': height from WRF variables" 1307 varNOcheck = ['WRFdens', 'WRFght', 'WRFp', 'WRFrh', 'TSrhs', 'WRFrhs', 'WRFT', \ 1308 'WRFt', 'WRFtd', 'WRFwd', 'TSwds', 'WRFwds', 'WRFws', 'TSwss', 'WRFwss', 'WRFz'] 1309 varNOcheckinf = "'WRFdens': air density from WRF variables; " + \ 1310 "'WRFght': geopotentiali height from WRF variables; " + \ 1311 "'WRFp': pressure from WRF variables; " + \ 1312 "'WRFrh': relative humidty fom WRF variables; " + \ 1313 "'WRFrhs': surface relative humidity from WRF variables; " + \ 1314 "'WRFT': CF-time from WRF variables; " + \ 1315 "'WRFt': temperature from WRF variables; " + \ 1316 "'WRFtd': dew-point temperature from WRF variables; " + \ 1317 "'WRFwd': wind direction from WRF variables; " + \ 1318 "'WRFwds': surface wind direction from WRF variables; " + \ 1319 "'WRFws': wind speed from WRF variables; " + \ 1320 "'WRFwss': surface wind speed from WRF variables; " + \ 1321 "'WRFz': height from WRF variables" 1234 1322 1235 1323 dimshelp = "[DIM]@[simdim]@[obsdim] ',' list of couples of dimensions names from " + \ … … 1239 1327 "no value, WRFdiagnosted variables also available: " + varNOcheckinf + ")" 1240 1328 varshelp="[simvar]@[obsvar]@[[oper]@[val]] ',' list of couples of variables to " + \ 1241 "validate and if necessary operation and value operations: " + opersinf + \ 1242 "(WRFdiagnosted variables also available: " + varNOcheckinf + ")" 1329 "validate and if necessary operation and value (sim. values) available " + \ 1330 "operations: " + opersinf + " (WRFdiagnosted variables also available: " + \ 1331 varNOcheckinf + ")" 1243 1332 statsn = ['minimum', 'maximum', 'mean', 'mean2', 'standard deviation'] 1244 1333 gstatsn = ['bias', 'simobs_mean', 'sim_obsmin', 'sim_obsmax', 'sim_obsmean', 'mae', \ … … 1255 1344 help=strkObs, metavar="FILE") 1256 1345 parser.add_option("-l", "--stationLocation", dest="stloc", 1257 help="name , longitude, latitude and height of the station (only for 'single-station')",1346 help="name (| for spaces), longitude, latitude and height of the station (only for 'single-station')", 1258 1347 metavar="FILE") 1259 1348 parser.add_option("-o", "--observation", dest="fobs", … … 1343 1432 quit(-1) 1344 1433 else: 1345 stationdesc = [opts.stloc.split(',')[0] ,\1434 stationdesc = [opts.stloc.split(',')[0].replace('|',' '), \ 1346 1435 np.float(opts.stloc.split(',')[1]), np.float(opts.stloc.split(',')[2]),\ 1347 1436 np.float(opts.stloc.split(',')[3])]
Note: See TracChangeset
for help on using the changeset viewer.