Changeset 1908 in lmdz_wrf
- Timestamp:
- Apr 18, 2018, 9:03:36 PM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r1833 r1908 33 33 # Forcompute_clt: Function to compute the total cloud fraction following 34 34 # 'newmicro.F90' from LMDZ via a Fortran module 35 # Forcompute_fog_K84: Computation of fog and visibility following Kunkel, (1984) 36 # Forcompute_fog_RUC: Computation of fog and visibility following RUC method Smirnova, (2000) 35 37 # Forcompute_potevap_orPM: Function to compute potential evapotranspiration following 36 38 # Penman-Monteith formulation implemented in ORCHIDEE … … 1135 1137 1136 1138 return var, vardims, varvdims 1139 1140 def Forcompute_fog_K84(qcloud, qice, dimns, dimvns): 1141 """ Function to compute fog and visibility following Kunkel, (1984) 1142 Forcompute_fog_K84(qcloud, qice, dimns, dimvns) 1143 [qcloud]= cloud mixing ratio [kgk-1] 1144 [qice]= ice mixing ratio [kgk-1] 1145 [dimns]= list of the name of the dimensions of [uas] 1146 [dimvns]= list of the name of the variables with the values of the 1147 dimensions of [qcloud] 1148 """ 1149 fname = 'Forcompute_fog_K84' 1150 1151 vardims = dimns[:] 1152 varvdims = dimvns[:] 1153 1154 if len(qcloud.shape) == 4: 1155 var= np.zeros((qcloud.shape[0],qcloud.shape[2],qcloud.shape[3]), dtype=np.float) 1156 1157 dx = qcloud.shape[3] 1158 dy = qcloud.shape[2] 1159 dz = qcloud.shape[1] 1160 dt = qcloud.shape[0] 1161 vardims.pop(1) 1162 varvdims.pop(1) 1163 1164 pvar1, pvar2 = fdin.module_fordiagnostics.compute_fog_k84( \ 1165 qc=qcloud[:,0,:,:].transpose(), qi=qice[:,0,:,:].transpose(), d1=dx, d2=dy,\ 1166 d3=dt) 1167 var1 = pvar1.transpose() 1168 var2 = pvar2.transpose() 1169 else: 1170 print errormsg 1171 print ' ' + fname + ': rank', len(qcloud.shape), 'not ready !!' 1172 print ' it only computes 4D [t,z,y,x] rank values' 1173 quit(-1) 1174 1175 return var1, var2, vardims, varvdims 1176 1177 def Forcompute_fog_RUC(qcloud, qice, dimns, dimvns): 1178 """ Function to compute fog and visibility following RUC method Smirnova, (2000) 1179 Forcompute_fog_K84(qcloud, qice, dimns, dimvns) 1180 [qcloud]= cloud mixing ratio [kgk-1] 1181 [qice]= ice mixing ratio [kgk-1] 1182 [dimns]= list of the name of the dimensions of [uas] 1183 [dimvns]= list of the name of the variables with the values of the 1184 dimensions of [qcloud] 1185 """ 1186 fname = 'Forcompute_fog_RUC' 1187 1188 vardims = dimns[:] 1189 varvdims = dimvns[:] 1190 1191 if len(qcloud.shape) == 4: 1192 var= np.zeros((qcloud.shape[0],qcloud.shape[2],qcloud.shape[3]), dtype=np.float) 1193 1194 dx = qcloud.shape[3] 1195 dy = qcloud.shape[2] 1196 dz = qcloud.shape[1] 1197 dt = qcloud.shape[0] 1198 vardims.pop(1) 1199 varvdims.pop(1) 1200 1201 pvar1, pvar2 = fdin.module_fordiagnostics.compute_fog_ruc( \ 1202 qc=qcloud[:,0,:,:].transpose(), qi=qice[:,0,:,:].transpose(), d1=dx, d2=dy,\ 1203 d3=dt) 1204 var1 = pvar1.transpose() 1205 var2 = pvar2.transpose() 1206 else: 1207 print errormsg 1208 print ' ' + fname + ': rank', len(qcloud.shape), 'not ready !!' 1209 print ' it only computes 4D [t,z,y,x] rank values' 1210 quit(-1) 1211 1212 return var1, var2, vardims, varvdims 1137 1213 1138 1214 ####### ###### ##### #### ### ## # END Fortran diagnostics -
trunk/tools/diagnostics.inf
r1809 r1908 11 11 clivi, WRFclivi, WRFdens@QICE@QHAIL@QGRAUPEL 12 12 clwvi, WRFclwvi, WRFdens@QCLOUD@QICE@QHAIL@QGRAUPEL 13 fog, fog_K84, QCLOUD@QICE 14 fog, fog_RUC, QCLOUD@QICE 13 15 hur, LMDZrh, pres@t@r 14 16 hur, WRFrh, WRFrh@T@P@PB -
trunk/tools/diagnostics.py
r1833 r1908 1 1 # Python script to comput diagnostics 2 # L. Fita, LMD. CNR, UPMC-Jussieu, Paris, France 2 # From L. Fita work in different places: CCRC (Australia), LMD (France) 3 # More information at: http://www.xn--llusfb-5va.cat/python/PyNCplot 4 # 5 # pyNCplot and its component nc_var.py comes with ABSOLUTELY NO WARRANTY. 6 # This work is licendes under a Creative Commons 7 # Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0) 8 # 9 # L. Fita, CIMA. CONICET-UBA, CNRS UMI-IFAECI, C.A. Buenos Aires, Argentina 3 10 # File diagnostics.inf provides the combination of variables to get the desired diagnostic 4 11 # To be used with module_ForDiagnostics.F90, module_ForDiagnosticsVars.F90, module_generic.F90 … … 76 83 ## MAIN 77 84 ####### 78 availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'deaccum', ' LMDZrh', 'mslp',\79 ' OMEGAw', 'RAINTOT',\85 availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'deaccum', 'fog_K84', 'fog_RUC', \ 86 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT', \ 80 87 'rvors', 'td', 'turbulence', 'WRFcape_afwa', 'WRFclivi', 'WRFclwvi', \ 81 88 'WRF_denszint', 'WRFgeop', \ … … 526 533 527 534 dtime = (var1[1] - var1[0])*diag.timeunits_seconds(tunits) 528 ncvar.insert_variable(ncobj, depvars[2], diagout/dtime, diagoutd, diagoutvd, newnc) 535 ncvar.insert_variable(ncobj, depvars[2], diagout/dtime, diagoutd, diagoutvd, \ 536 newnc) 537 538 # fog_K84: Computation of fog and visibility following Kunkel, (1984) 539 elif diagn == 'fog_K84': 540 541 var0 = ncobj.variables[depvars[0]] 542 var1 = ncobj.variables[depvars[1]] 543 544 dnamesvar = list(var0.dimensions) 545 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 546 547 diag1, diag2, diagoutd, diagoutvd = diag.Forcompute_fog_K84(var0, var1, \ 548 dnamesvar, dvnamesvar) 549 # Removing the nonChecking variable-dimensions from the initial list 550 varsadd = [] 551 diagoutvd = list(dvnames) 552 for nonvd in NONchkvardims: 553 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 554 varsadd.append(nonvd) 555 ncvar.insert_variable(ncobj, 'fog', diag1, diagoutd, diagoutvd, newnc) 556 ncvar.insert_variable(ncobj, 'fogvisblty', diag2, diagoutd, diagoutvd, newnc) 557 558 # fog_RUC: Computation of fog and visibility following Kunkel, (1984) 559 elif diagn == 'fog_RUC': 560 561 var0 = ncobj.variables[depvars[0]] 562 var1 = ncobj.variables[depvars[1]] 563 564 dnamesvar = list(var0.dimensions) 565 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 566 567 diag1, diag2, diagoutd, diagoutvd = diag.Forcompute_fog_RUC(var0, var1, \ 568 dnamesvar, dvnamesvar) 569 # Removing the nonChecking variable-dimensions from the initial list 570 varsadd = [] 571 diagoutvd = list(dvnames) 572 for nonvd in NONchkvardims: 573 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 574 varsadd.append(nonvd) 575 ncvar.insert_variable(ncobj, 'fog', diag1, diagoutd, diagoutvd, newnc) 576 ncvar.insert_variable(ncobj, 'fogvisblty', diag2, diagoutd, diagoutvd, newnc) 529 577 530 578 # LMDZrh (pres, t, r) -
trunk/tools/module_ForDiagnostics.f90
r1833 r1908 24 24 ! compute_clt3D3: Computation of total cloudiness from a 3D CLDFRA being 3rd dimension the z-dim 25 25 ! compute_clt: Computation of total cloudiness 26 ! compute_fog_K84: Computation of fog and visibility following Kunkel, (1984) 27 ! compute_fog_RUC: Computation of fog and visibility following RUC method Smirnova, (2000) 26 28 ! compute_psl_ecmwf: Compute sea level pressure using ECMWF method following Mats Hamrud and Philippe Courtier [Pa] 27 29 ! compute_massvertint1D: Subroutine to vertically integrate a 1D variable in eta vertical coordinates … … 833 835 END SUBROUTINE compute_potevap_orPM3D 834 836 837 SUBROUTINE compute_fog_K84(d1, d2, d3, qc, qi, fog, vis) 838 ! Subroutine to compute fog: qcloud + qice /= 0. 839 ! And visibility following Kunkel, B. A., (1984): Parameterization of droplet terminal velocity and 840 ! extinction coefficient in fog models. J. Climate Appl. Meteor., 23, 34â41. 841 842 IMPLICIT NONE 843 844 INTEGER, INTENT(in) :: d1, d2, d3 845 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(in) :: qc, qi 846 INTEGER, DIMENSION(d1,d2,d3), INTENT(out) :: fog 847 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(out) :: vis 848 849 ! Local 850 INTEGER :: i, j, it 851 852 !!!!!!! Variables 853 ! qc: cloud mixing ratio [kgkg-1] 854 ! qi, ice mixing ratio [kgkg-1] 855 ! fog: presence of fog (1: yes, 0: no) 856 ! vis: visibility within fog [km] 857 858 fname = 'compute_fog_K84' 859 860 DO i=1, d1 861 DO j=1, d2 862 DO it=1, d3 863 CALL var_fog_K84(qc(i,j,it), qi(i,j,it), fog(i,j,it), vis(i,j,it)) 864 END DO 865 END DO 866 END DO 867 868 RETURN 869 870 END SUBROUTINE compute_fog_K84 871 872 SUBROUTINE compute_fog_RUC(d1, d2, d3, qc, qi, fog, vis) 873 ! Subroutine to compute fog: qcloud + qice /= 0. 874 ! And visibility following RUC method Smirnova, T. G., S. G. Benjamin, and J. M. Brown, 2000: Case 875 ! study verification of RUC/MAPS fog and visibility forecasts. Preprints, 9 th Conference on 876 ! Aviation, Range, and Aerospace Meteorlogy, AMS, Orlando, FL, Sep. 2000. Paper#2.3, 6 pp. 877 878 IMPLICIT NONE 879 880 INTEGER, INTENT(in) :: d1, d2, d3 881 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(in) :: qc, qi 882 INTEGER, DIMENSION(d1,d2,d3), INTENT(out) :: fog 883 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(out) :: vis 884 885 ! Local 886 INTEGER :: i, j, it 887 888 !!!!!!! Variables 889 ! qc: cloud mixing ratio [kgkg-1] 890 ! qi, ice mixing ratio [kgkg-1] 891 ! fog: presence of fog (1: yes, 0: no) 892 ! vis: visibility within fog [km] 893 894 fname = 'compute_fog_K84' 895 896 DO i=1, d1 897 DO j=1, d2 898 DO it=1, d3 899 CALL var_fog_K84(qc(i,j,it), qi(i,j,it), fog(i,j,it), vis(i,j,it)) 900 END DO 901 END DO 902 END DO 903 904 RETURN 905 906 END SUBROUTINE compute_fog_RUC 907 835 908 END MODULE module_ForDiagnostics -
trunk/tools/module_ForDiagnosticsVars.f90
r1804 r1908 29 29 ! var_cllmh: low, medium, high-cloud [0,1] 30 30 ! var_clt: total cloudiness [0,1] 31 ! var_fog_K84: Computation of fog and visibility following Kunkel, (1984) 32 ! var_fog_RUC: Computation of fog and visibility following RUC method Smirnova, (2000) 31 33 ! var_potevap_orPM: potential evapotranspiration following Penman-Monteith formulation implemented in ORCHIDEE 32 34 ! var_psl_ecmwf: sea level pressure using ECMWF method following Mats Hamrud and Philippe Courtier [Pa] … … 1438 1440 END SUBROUTINE var_potevap_orPM 1439 1441 1442 SUBROUTINE var_fog_K84(qc, qi, fog, vis) 1443 ! Computation of fog: qcloud + qice /= 0. 1444 ! And visibility following Kunkel, B. A., (1984): Parameterization of droplet terminal velocity and 1445 ! extinction coefficient in fog models. J. Climate Appl. Meteor., 23, 34â41. 1446 1447 IMPLICIT NONE 1448 1449 REAL(r_k), INTENT(in) :: qc, qi 1450 INTEGER, INTENT(out) :: fog 1451 REAL(r_k), INTENT(out) :: vis 1452 1453 ! Local 1454 REAL(r_k) :: qfog, visc, visi 1455 1456 !!!!!!! Variables 1457 ! qc: cloud mixing ratio [kgkg-1] 1458 ! qi, ice mixing ratio [kgkg-1] 1459 ! fog: presence of fog (1: yes, 0: no) 1460 ! vis: visibility within fog [km] 1461 1462 fname = 'var_fog_K84' 1463 1464 qfog = (qc + qi)*1000.*oneRK 1465 IF (qfog /= zeroRK) THEN 1466 fog = 1 1467 ! From: Gultepe, 2006, JAM, 45, 1469-1480 1468 IF (qc /= 0.) visc = 0.027*(qc*1000.)**(-0.88) 1469 IF (qi /= 0.) visi = 0.024*(qi*1000.)**(-1.0) 1470 vis = MINVAL((/visc, visi/)) 1471 ELSE 1472 fog = 0 1473 vis = zeroRK 1474 END IF 1475 PRINT *,'qc:', qc,'qi:',qi,'qfog:',qfog,'visc:',visc,'visi:',visi,'vis:',vis 1476 1477 1478 END SUBROUTINE var_fog_K84 1479 1480 SUBROUTINE var_fog_RUC(qc, qi, fog, vis) 1481 ! Computation of fog: qcloud + qice /= 0. 1482 ! And visibility following RUC method Smirnova, T. G., S. G. Benjamin, and J. M. Brown, 2000: Case 1483 ! study verification of RUC/MAPS fog and visibility forecasts. Preprints, 9 th Conference on 1484 ! Aviation, Range, and Aerospace Meteorlogy, AMS, Orlando, FL, Sep. 2000. Paper#2.3, 6 pp. 1485 1486 IMPLICIT NONE 1487 1488 REAL(r_k), INTENT(in) :: qc, qi 1489 INTEGER, INTENT(out) :: fog 1490 REAL(r_k), INTENT(out) :: vis 1491 1492 ! Local 1493 REAL(r_k) :: qfog 1494 1495 !!!!!!! Variables 1496 ! qc: cloud mixing ratio [kgkg-1] 1497 ! qi, ice mixing ratio [kgkg-1] 1498 ! fog: presence of fog (1: yes, 0: no) 1499 ! vis: visibility within fog [km] 1500 1501 fname = 'var_fog_RUC' 1502 1503 qfog = (qc + qi)*1000.*oneRK 1504 IF (qfog /= zeroRK) THEN 1505 fog = 1 1506 ! From: Gultepe, I., and G. Isaac, 2006: Visbility versus precipitation rate and relative 1507 ! humidity. Preprints, 12th Cloud Physics Conf, Madison, WI, Amer. Meteor. Soc., P2.55. 1508 ! [Available online at http://ams.confex.com/ams/Madison2006/techprogram/paper_l13177.htm] 1509 vis = 60.*exp(-2.5*(qc*1000.-15.)/80.) 1510 ELSE 1511 fog = 0 1512 vis = zeroRK 1513 END IF 1514 PRINT *,'qc:', qc,'qi:',qi,'qfog:',qfog,'vis:',vis 1515 1516 END SUBROUTINE var_fog_RUC 1517 1440 1518 END MODULE module_ForDiagnosticsVars -
trunk/tools/variables_values.dat
r1893 r1908 161 161 evspsblpot, evspsblpot, potential_water_evapotranspiration_flux, 0., 1.5e-4, potential|evapotranspiration|flux, kgm-2s-1, Blues, $evspsblpot$, evspsblpot 162 162 EVSPSBLPOT, evspsblpot, potential_water_evapotranspiration_flux, 0., 1.5e-4, potential|evapotranspiration|flux, kgm-2s-1, Blues, $evspsblpot$, evspsblpot 163 fog, fog, fog, 0, 1, presence|of|fog|(0:no|1:yes), 1, Purples, $fog$, fog 163 164 g, g, grauepl_mixing_ratio, 0., 0.0003, graupel|mixing|ratio, kgkg-1, Purples, $qg$, qg 164 165 QGRAUP, g, grauepl_mixing_ratio, 0., 0.0003, graupel|mixing|ratio, kgkg-1, Purples, $qg$, qg … … 487 488 vascurv, vas, eastward_wind, -30., 30., eastward|wind, ms-1, seismic, $vas$, vas 488 489 veget, veget, vegetation_type, 1, 13, type|of|plant|functional|type, 1, Reds, $veget$, veget 490 fogvisblty, fogvisblty, fog_visibility, 0., 5000., visibility|inside|fog, km, Purples, $fogvisblty$, fogvisblty 489 491 wakedeltaq, wakedeltaq, wake_delta_vapor, -0.003, 0.003, wake|delta|mixing|ratio, kgkg-1s-1, seismic, $\partial_{t}qv^{wak}$, dtqv_wak 490 492 wake_deltaq, wakedeltaq, wake_delta_vapor, -0.003, 0.003, wake|delta|mixing|ratio, kgkg-1s-1, seismic, $\partial_{t}qv^{wak}$, dtqv_wak
Note: See TracChangeset
for help on using the changeset viewer.