Changeset 2387 in lmdz_wrf for trunk/tools
- Timestamp:
- Mar 11, 2019, 11:40:11 AM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/Makefile.llamp
r2357 r2387 95 95 pygenmods.o \ 96 96 pydefmods.o \ 97 trajectories_overlap.o 97 trajectories_overlap.o \ 98 test_Fmods.o 98 99 99 100 pymods : \ … … 119 120 120 121 clean : 121 $(RM) *.mod *.o interpolate module_ForDiag.so module_ForInt.so module_ForDistriCorrect.so module_ForSci.so module_ForGen.so module_ForDef.so122 $(RM) *.mod *.o interpolate test_Fmods module_ForDiag.so module_ForInt.so module_ForDistriCorrect.so module_ForSci.so module_ForGen.so module_ForDef.so 122 123 123 124 ######## ####### … … 161 162 $(FC) $(FCEXECFLAGS) DistriCorrection.f90 -o DistriCorrection 162 163 164 test_Fmods.o: module_definitions.o module_basic.o module_generic.o module_scientific.o module_ForDiagnostics.o module_ForDiagnosticsVars.o 165 $(FC) $(FCEXEFCFLAGS) test_Fmods.f90 -o test_Fmods 166 163 167 pydistrimods.o: 164 168 $(F2PY) -c $(F2PYF) -I$(NCINCFOLD) -m module_ForDistriCorrect $(distrisrcs) -L$(NCLIBFOLD) -
trunk/tools/diag_tools.py
r2341 r2387 71 71 # var_td_Uhus: Function to compute dew-point air temperature from temperature and 72 72 # pressure values using hus 73 # var_tws_S11: Function to compute Wet Bulb temperature after Stull, 2011 73 74 # var_timemax: This function returns the time at which variable reaches its maximum in time 74 75 # units … … 2176 2177 2177 2178 return td 2179 2180 def var_tws_S11(ta0, hur0): 2181 """ Function to compute Wet Bulb temperature using equation after: 2182 Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269, 2183 doi: 10.1175/JAMC-D-11-0143.1 2184 [ta]= temperature (assuming [[t],z,y,x] in [K]) 2185 [hur] = relative humidity (assuming in [1]) 2186 >>> var_rh_S11(293.15, 0.5) 2187 13.699341969 2188 """ 2189 fname = 'var_tws_S11' 2190 2191 ta = ta0 - 273.15 2192 hur = hur0*100. 2193 2194 # Does it has any sense not in surface? 2195 tws = ta*np.arctan(0.151977*np.sqrt(hur+8.313659)) + np.arctan(ta+hur) - \ 2196 np.arctan(hur-1.676331) + 0.00391838*(hur)**(1.5)*np.arctan(0.023101*hur) - \ 2197 4.686035 2198 2199 return tws 2178 2200 2179 2201 def var_wd(u, v): -
trunk/tools/diagnostics.py
r2346 r2387 928 928 ncvar.insert_variable(ncobj, 'lat_bnds', cellbndsy, diagoutd, diagoutvd, newnc) 929 929 930 # tws: Bet Wulb temperature following Stull 2011 (tas, hur) 931 elif diagn == 'rws': 932 933 var0 = ncobj.variables[depvars[0]][:] 934 var1 = ncobj.variables[depvars[1]][:] 935 936 diagout, diagoutd, diagoutvd = diag.var_tws_S11(var0,var1,dnames,dvnames) 937 ncvar.insert_variable(ncobj, 'tws', diagout, diagoutd, diagoutvd, newnc) 938 930 939 # cell_bnds: grid cell bounds from XLONG_U, XLAT_U, XLONG_V, XLAT_V as intersection 931 940 # of their related parallels and meridians … … 1056 1065 varsadd.append(nonvd) 1057 1066 ncvar.insert_variable(ncobj, 'psl', diagout, diagoutd, diagoutvd, newnc) 1067 1068 # WRFtws: Bet Wulb temperature following Stull 2011 (PSFC, T2, Q2) 1069 elif diagn == 'WRFtws': 1070 1071 var0 = ncobj.variables[depvars[0]][:] 1072 var1 = ncobj.variables[depvars[1]][:] 1073 var2 = ncobj.variables[depvars[2]][:] 1074 1075 dnamesvar = list(ncobj.variables[depvars[2]].dimensions) 1076 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1077 1078 hurs, diagoutd, diagoutvd = diag.compute_rh(var0,var1,var2,dnamesvar,dvnamesvar) 1079 1080 diagout = diag.var_tws_S11(var1, hurs) 1081 # Removing the nonChecking variable-dimensions from the initial list 1082 varsadd = [] 1083 diagoutvd = list(dvnames) 1084 for nonvd in NONchkvardims: 1085 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 1086 varsadd.append(nonvd) 1087 1088 ncvar.insert_variable(ncobj, 'tws', diagout, diagoutd, diagoutvd, newnc) 1058 1089 1059 1090 # OMEGAw (omega, p, t) from NCL formulation (https://www.ncl.ucar.edu/Document/Functions/Contributed/omega_to_w.shtml) -
trunk/tools/module_ForDiagnostics.f90
r2345 r2387 35 35 ! compute_psl_ecmwf: Compute sea level pressure using ECMWF method following Mats Hamrud and Philippe Courtier [Pa] 36 36 ! compute_range_faces: Subroutine to compute faces [uphill, valleys, downhill] of a mountain range along a given face 37 ! compute_tws_RK[1/2/3/4]: Subroutine to compute Wet Bulb temperature of 1/2/3/4D series of values 37 38 ! compute_vertint1D: Subroutine to vertically integrate a 1D variable in any vertical coordinates 38 39 ! compute_zint4D: Subroutine to vertically integrate a 4D variable in any vertical coordinates … … 845 846 ! Subroutine to compute fog: qcloud + qice /= 0. 846 847 ! And visibility following Kunkel, B. A., (1984): Parameterization of droplet terminal velocity and 847 ! extinction coefficient in fog models. J. Climate Appl. Meteor., 23, 34 â41.848 ! extinction coefficient in fog models. J. Climate Appl. Meteor., 23, 34-41. 848 849 849 850 IMPLICIT NONE … … 1357 1358 END SUBROUTINE compute_Koeppen_Geiger_climates 1358 1359 1360 SUBROUTINE compute_tws_RK1(d1, tas, hurs, tws) 1361 ! Subroutine to compute Wet Bulb temperature of 1D series of values using equation after: 1362 ! Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269. doi: 10.1175/JAMC-D-11-0143.1 1363 1364 IMPLICIT NONE 1365 1366 INTEGER, INTENT(in) :: d1 1367 REAL(r_k), DIMENSION(d1), INTENT(in) :: tas, hurs 1368 REAL(r_k), DIMENSION(d1), INTENT(out) :: tws 1369 1370 ! Local 1371 INTEGER :: it 1372 1373 !!!!!!! Variables 1374 ! tas: 2-m air temperature [K] 1375 ! hurs: 2-m relative humidity [1] 1376 1377 fname = 'compute_tws_RK1' 1378 1379 DO it=1, d1 1380 tws(it) = var_tws_S11(tas(it), hurs(it)) 1381 END DO 1382 1383 RETURN 1384 1385 END SUBROUTINE compute_tws_RK1 1386 1387 SUBROUTINE compute_tws_RK2(d1, d2, tas, hurs, tws) 1388 ! Subroutine to compute Wet Bulb temperature of 2D series of values using equation after: 1389 ! Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269. doi: 10.1175/JAMC-D-11-0143.1 1390 1391 IMPLICIT NONE 1392 1393 INTEGER, INTENT(in) :: d1, d2 1394 REAL(r_k), DIMENSION(d1,d2), INTENT(in) :: tas, hurs 1395 REAL(r_k), DIMENSION(d1,d2), INTENT(out) :: tws 1396 1397 ! Local 1398 INTEGER :: i, j 1399 1400 !!!!!!! Variables 1401 ! tas: 2-m air temperature [K] 1402 ! hurs: 2-m relative humidity [1] 1403 1404 fname = 'compute_tws_RK2' 1405 1406 DO i=1, d1 1407 DO j=1, d2 1408 tws(i,j) = var_tws_S11(tas(i,j), hurs(i,j)) 1409 END DO 1410 END DO 1411 1412 RETURN 1413 1414 END SUBROUTINE compute_tws_RK2 1415 1416 SUBROUTINE compute_tws_RK3(d1, d2, d3, tas, hurs, tws) 1417 ! Subroutine to compute Wet Bulb temperature of 3D series of values using equation after: 1418 ! Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269. doi: 10.1175/JAMC-D-11-0143.1 1419 1420 IMPLICIT NONE 1421 1422 INTEGER, INTENT(in) :: d1, d2, d3 1423 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(in) :: tas, hurs 1424 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(out) :: tws 1425 1426 ! Local 1427 INTEGER :: i, j, k 1428 1429 !!!!!!! Variables 1430 ! tas: 2-m air temperature [K] 1431 ! hurs: 2-m relative humidity [1] 1432 1433 fname = 'compute_tws_RK3' 1434 1435 DO i=1, d1 1436 DO j=1, d2 1437 DO k=1, d3 1438 tws(i,j,k) = var_tws_S11(tas(i,j,k), hurs(i,j,k)) 1439 END DO 1440 END DO 1441 END DO 1442 1443 RETURN 1444 1445 END SUBROUTINE compute_tws_RK3 1446 1447 SUBROUTINE compute_tws_RK4(d1, d2, d3, d4, tas, hurs, tws) 1448 ! Subroutine to compute Wet Bulb temperature of 4D series of values using equation after: 1449 ! Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269. doi: 10.1175/JAMC-D-11-0143.1 1450 1451 IMPLICIT NONE 1452 1453 INTEGER, INTENT(in) :: d1, d2, d3, d4 1454 REAL(r_k), DIMENSION(d1,d2,d3,d4), INTENT(in) :: tas, hurs 1455 REAL(r_k), DIMENSION(d1,d2,d3,d4), INTENT(out) :: tws 1456 1457 ! Local 1458 INTEGER :: i,j,k,l 1459 1460 !!!!!!! Variables 1461 ! tas: 2-m air temperature [K] 1462 ! hurs: 2-m relative humidity [1] 1463 1464 fname = 'compute_tws_RK4' 1465 1466 DO i=1, d1 1467 DO j=1, d2 1468 DO k=1, d3 1469 DO l=1, d4 1470 tws(i,j,k,l) = var_tws_S11(tas(i,j,k,l), hurs(i,j,k,l)) 1471 END DO 1472 END DO 1473 END DO 1474 END DO 1475 1476 RETURN 1477 1478 END SUBROUTINE compute_tws_RK4 1479 1359 1480 END MODULE module_ForDiagnostics -
trunk/tools/module_ForDiagnosticsVars.f90
r2223 r2387 38 38 ! var_range_faces: compute faces [uphill, valleys, downhill] of a monuntain range along a face 39 39 ! var_rh: Subroutine to compute relative humidity following 'Tetens' equation (T,P) ...' 40 ! var_tws_S11: Function to compute wet bulb temperature after Stull, 2011 40 41 ! var_zmla_generic: Subroutine to compute pbl-height following a generic method 41 42 ! var_zwind: Subroutine to extrapolate the wind at a given height following the 'power law' methodology … … 1918 1919 END SUBROUTINE var_hur 1919 1920 1921 REAL(r_k) FUNCTION var_tws_S11(ta0, hur0) 1922 ! Function to compute wet bulb temperature using equation after: 1923 ! Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269. doi: 10.1175/JAMC-D-11-0143.1 1924 1925 IMPLICIT NONE 1926 1927 REAL(r_k), INTENT(in) :: ta0, hur0 1928 1929 ! Local 1930 REAL :: ta, hur 1931 1932 !!!!!!! Variables 1933 ! ta0: temperature [K] (does it only make sense if it is at 2 m?) 1934 ! hur0: relative humidity [1] (does it only make sense if it is at 2 m?) 1935 ! tws: wet bulb temperature [C] 1936 1937 fname = 'var_tws_S11' 1938 1939 ta = ta0 - SVPT0 1940 hur = hur0*100.*oneRK 1941 1942 var_tws_S11 = ta * ATAN(0.151977*SQRT(hur+8.313659)) + ATAN(ta+hur) - ATAN(hur-1.676331) + & 1943 0.00391838*(hur)**(1.5)*ATAN(0.023101*hur) - 4.686035 1944 1945 RETURN 1946 1947 END FUNCTION var_tws_S11 1948 1949 SUBROUTINE Svar_tws_S11(ta0, hur0, tws) 1950 ! Subroutine to compute wet bulb temperature using equation after: 1951 ! Stull, R. (2011), J. Appl. Meteor. Climatol. 50(11):2267-2269. doi: 10.1175/JAMC-D-11-0143.1 1952 1953 IMPLICIT NONE 1954 1955 REAL(r_k), INTENT(in) :: ta0, hur0 1956 REAL(r_k), INTENT(out) :: tws 1957 1958 ! Local 1959 REAL :: ta, hur 1960 1961 !!!!!!! Variables 1962 ! ta0: temperature [K] (does it only make sense if it is at 2 m?) 1963 ! hur0: relative humidity [1] (does it only make sense if it is at 2 m?) 1964 ! tws: wet bulb temperature [C] 1965 1966 fname = 'var_tws_S11' 1967 1968 ta = ta0 - SVPT0 1969 hur = hur0*100.*oneRK 1970 1971 tws = ta * ATAN(0.151977*SQRT(hur+8.313659)) + ATAN(ta+hur) - ATAN(hur-1.676331) + & 1972 0.00391838*(hur)**(1.5)*ATAN(0.023101*hur) - 4.686035 1973 1974 RETURN 1975 1976 END SUBROUTINE Svar_tws_S11 1977 1920 1978 END MODULE module_ForDiagnosticsVars -
trunk/tools/variables_values.dat
r2378 r2387 541 541 tottotalsi, tottoalsi, totals_totals_index, 0., 100., Totals|totals|index, C, Reds, $TOTtoti$, TOTtoti 542 542 Totals totals index, tottoalsi, totals_totals_index, 0., 100., Totals|totals|index, C, Reds, $TOTtoti$, TOTtoti 543 tws, tws, air_wet_bulb_temperature, -10., 40., air|wet|bulb|temperature|at|2m, C, YlGnBu, $tws$, tws 544 TWS, tws, air_wet_bulb_temperature, -10., 40., air|wet|bulb|temperature|at|2m, C, YlGnBu, $tws$, tws 543 545 ua, ua, eastward_wind, -30., 30., eastward|wind, ms-1, seismic, $ua$, ua 544 546 vitu, ua, eastward_wind, -30., 30., eastward|wind, ms-1, seismic, $ua$, ua
Note: See TracChangeset
for help on using the changeset viewer.