Changeset 612 in lmdz_wrf
- Timestamp:
- Aug 14, 2015, 12:31:49 PM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diagnostics.inf
r441 r612 8 8 SPDUV U@V 9 9 SPDUV10 U10@V10 10 TSrhs psfc@t@q 11 TStd psfc@t@q 12 TSwds u@v 13 TSwss u@v 10 14 WRFbils HFX@LH 11 15 WRFmslp WRFp@PSFC@HGT@WRFt@QVAPOR … … 17 21 WRFrhs PSFC@T2@Q2 18 22 WRFrvors U10@V10@WRFpos 23 WRFtd WRFp@WRFt2@QVAPOR 24 WRFtds PSFC@T2@Q2 19 25 WRFwss U10@V10 26 WRFwds U10@V10 20 27 wss U10@V10 28 wss U10@V10 -
trunk/tools/diagnostics.py
r600 r612 578 578 return rh, rhdims, rhvdims 579 579 580 def compute_td(p, temp, qv, dimns, dimvns): 581 """ Function to compute the dew point temperature 582 [p]= pressure [Pa] 583 [temp]= temperature [C] 584 [qv]= mixing ratio [kgkg-1] 585 [dimns]= list of the name of the dimensions of [p] 586 [dimvns]= list of the name of the variables with the values of the 587 dimensions of [p] 588 """ 589 fname = 'compute_td' 590 591 # print ' ' + fname + ': computing dew-point temperature from TS as t and Tetens...' 592 # tacking from: http://en.wikipedia.org/wiki/Dew_point 593 tk = temp 594 data1 = 10.*0.6112*np.exp(17.67*(tk-273.16)/(tk-29.65)) 595 data2 = 0.622*data1/(0.01*p-(1.-0.622)*data1) 596 597 rh = qv/data2 598 599 pa = rh * data1 600 varNOcheckv = 257.44*np.log(pa/6.1121)/(18.678-np.log(pa/6.1121)) 601 602 dimensions = ncobj.variables['t'].dimensions 603 shape = ncobj.variables['t'].shape 604 605 tddims = dimns[:] 606 tdvdims = dimvns[:] 607 608 return td, tddims, tdvdims 609 580 610 def turbulence_var(varv, dimvn, dimn): 581 611 """ Function to compute the Taylor's decomposition turbulence term from a a given variable … … 627 657 628 658 return turb, turbdims, turbvdims 659 660 def compute_wds(u, v, dimns, dimvns): 661 """ Function to compute the wind direction 662 [u]= W-E wind direction [ms-1, knot, ...] 663 [v]= N-S wind direction [ms-1, knot, ...] 664 [dimns]= list of the name of the dimensions of [u] 665 [dimvns]= list of the name of the variables with the values of the 666 dimensions of [u] 667 """ 668 fname = 'compute_wds' 669 670 # print ' ' + fname + ': computing wind direction as ATAN2(v,u) ...' 671 theta = np.arctan2(v,u) 672 theta = np.where(theta < 0., theta + 2.*np.pi, theta) 673 674 wds = 360.*theta/(2.*np.pi) 675 676 wdsdims = dimns[:] 677 wdsvdims = dimvns[:] 678 679 return wds, wdsdims, wdsvdims 680 681 def compute_wss(u, v, dimns, dimvns): 682 """ Function to compute the wind speed 683 [u]= W-E wind direction [ms-1, knot, ...] 684 [v]= N-S wind direction [ms-1, knot, ...] 685 [dimns]= list of the name of the dimensions of [u] 686 [dimvns]= list of the name of the variables with the values of the 687 dimensions of [u] 688 """ 689 fname = 'compute_wss' 690 691 # print ' ' + fname + ': computing wind speed as SQRT(v**2 + u**2) ...' 692 wss = np.sqrt(u*u + v*v) 693 694 wssdims = dimns[:] 695 wssvdims = dimvns[:] 696 697 return wss, wssdims, wssvdims 629 698 630 699 def timeunits_seconds(dtu): … … 673 742 ####### 674 743 availdiags = ['ACRAINTOT', 'clt', 'cllmh', 'deaccum', 'LMDZrh', 'mslp', 'RAINTOT', \ 675 'rvors', 't urbulence', 'WRFrvors']744 'rvors', 'td', 'turbulence', 'WRFrvors', 'wds', 'wss'] 676 745 677 746 # Variables not to check 678 NONcheckingvars = ['cllmh', 'deaccum', 'WRFbils', 'WRFdens', 'WRFgeop', 'WRFp', \ 747 NONcheckingvars = ['cllmh', 'deaccum', 'TSrhs', 'TStd', 'TSwds', 'TSwss', 'WRFbils', \ 748 'WRFdens', 'WRFgeop', \ 749 'WRFp', 'WRFtd', \ 679 750 'WRFpos', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs', 'WRFrhs', 'WRFrvors', \ 680 'WRFt', 'WRFtime' ]751 'WRFt', 'WRFtime', 'WRFwds', 'WRFwss'] 681 752 682 753 ofile = 'diagnostics.nc' … … 1010 1081 ncvar.insert_variable(ncobj, 'pr', diagout/dtime, diagoutd, diagoutvd, newnc) 1011 1082 1083 # rhs (psfc, t, q) from TimeSeries files 1084 elif diag == 'TSrhs': 1085 1086 p0=100000. 1087 var0 = ncobj.variables[depvars[0]][:] 1088 var1 = (ncobj.variables[depvars[1]][:])*(var0/p0)**(2./7.) 1089 var2 = ncobj.variables[depvars[2]][:] 1090 1091 dnamesvar = ncobj.variables[depvars[0]].dimensions 1092 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1093 1094 diagout, diagoutd, diagoutvd = compute_rh(var0,var1,var2,dnamesvar,dvnamesvar) 1095 1096 ncvar.insert_variable(ncobj, 'huss', diagout, diagoutd, diagoutvd, newnc) 1097 1098 # td (psfc, t, q) from TimeSeries files 1099 elif diag == 'TStd' or diag = 'td': 1100 1101 var0 = ncobj.variables[depvars[0]][:] 1102 var1 = ncobj.variables[depvars[1]][:] - 273.15 1103 var2 = ncobj.variables[depvars[2]][:] 1104 1105 dnamesvar = ncobj.variables[depvars[0]].dimensions 1106 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1107 1108 diagout, diagoutd, diagoutvd = compute_td(var0,var1,var2,dnamesvar,dvnamesvar) 1109 1110 ncvar.insert_variable(ncobj, 'tds', diagout, diagoutd, diagoutvd, newnc) 1111 1112 # td (psfc, t, q) from TimeSeries files 1113 elif diag = 'tdC': 1114 1115 var0 = ncobj.variables[depvars[0]][:] 1116 # Temperature is already in degrees Celsius 1117 var1 = ncobj.variables[depvars[1]][:] 1118 var2 = ncobj.variables[depvars[2]][:] 1119 1120 dnamesvar = ncobj.variables[depvars[0]].dimensions 1121 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1122 1123 diagout, diagoutd, diagoutvd = compute_td(var0,var1,var2,dnamesvar,dvnamesvar) 1124 1125 ncvar.insert_variable(ncobj, 'tds', diagout, diagoutd, diagoutvd, newnc) 1126 1127 # wds (u, v) 1128 elif diag == 'TSwds' or diag == 'wds' : 1129 1130 var0 = ncobj.variables[depvars[0]][:] 1131 var1 = ncobj.variables[depvars[1]][:] 1132 1133 dnamesvar = ncobj.variables[depvars[0]].dimensions 1134 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1135 1136 diagout, diagoutd, diagoutvd = compute_wds(var0,var1,dnamesvar,dvnamesvar) 1137 1138 ncvar.insert_variable(ncobj, 'wds', diagout, diagoutd, diagoutvd, newnc) 1139 1140 # wss (u, v) 1141 elif diag == 'TSwss' or diag = 'wss': 1142 1143 var0 = ncobj.variables[depvars[0]][:] 1144 var1 = ncobj.variables[depvars[1]][:] 1145 1146 dnamesvar = ncobj.variables[depvars[0]].dimensions 1147 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1148 1149 diagout, diagoutd, diagoutvd = compute_wss(var0,var1,dnamesvar,dvnamesvar) 1150 1151 ncvar.insert_variable(ncobj, 'wss', diagout, diagoutd, diagoutvd, newnc) 1152 1012 1153 # turbulence (var) 1013 1154 elif diag == 'turbulence':
Note: See TracChangeset
for help on using the changeset viewer.