Changeset 2655 in lmdz_wrf
- Timestamp:
- Jul 2, 2019, 8:37:56 PM (5 years ago)
- Location:
- trunk/tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r2643 r2655 1533 1533 varvdims, ranges, rangeshgtmax, ptrangeshgtmax 1534 1534 1535 def Forcompute_front_R04(tas, uas, vas, dxs, dys, d imns, dimvns):1535 def Forcompute_front_R04(tas, uas, vas, dxs, dys, dtas, dwss, dimns, dimvns): 1536 1536 """ Function to compute front following Rodrigues et al.(2004), Rev. Bras. 1537 1537 Geofis. 22, 135-151 … … 1542 1542 [dxs]= grid spacing between grid points along x-axis (assuming [y,x]) [m] 1543 1543 [dys]= grid spacing between grid points along y-axis (assuming [y,x]) [m] 1544 [dtas]= sensitivity to the thermal temporal increment [K] 1545 [ddwss]= sensitivity to the wind gradient [ms-1m-1] 1544 1546 [dimns]= list of the name of the dimensions of [pa] 1545 1547 [dimvns]= list of the name of the variables with the values of the … … 1548 1550 fname = 'Forcompute_front_R04' 1549 1551 1550 psldims = dimns[:]1551 pslvdims = dimvns[:]1552 1553 if len( pa.shape) == 3:1552 frontdims = dimns[:] 1553 frontvdims = dimvns[:] 1554 1555 if len(tas.shape) == 3: 1554 1556 front = np.zeros((tas.shape[0],tas.shape[1],tas.shape[2]), dtype=np.float) 1555 1557 … … 1558 1560 dt = tas.shape[0] 1559 1561 1560 pfront=fdin.module_fordiagnostics.compute_front_R04d3(tas=tas[:].transpose(),\ 1561 uas=uas[:].transpose(), vas=vas[:].transpose(), dxs=dxs[:].transpose(), \ 1562 dys=dys[:].transpose(), d1=dx, d2=dy, d3=dt) 1562 pfront, pdt1tas, pdd1wss, pdt2tas = \ 1563 fdin.module_fordiagnostics.compute_front_r04d3(tas=tas[:].transpose(), \ 1564 uas=uas[:].transpose(), vas=vas[:].transpose(), ddtas=dtas, ddwss=dwss, \ 1565 dsx=dxs[:].transpose(), dsy=dys[:].transpose(), d1=dx, d2=dy, d3=dt) 1563 1566 front = pfront.transpose() 1567 dt1tas = pdt1tas.transpose() 1568 dd1wss = pdd1wss.transpose() 1569 dt2tas = pdt2tas.transpose() 1570 1564 1571 else: 1565 1572 print errormsg 1566 print ' ' + fname + ': rank', len( pa.shape), 'not ready !!'1573 print ' ' + fname + ': rank', len(tas.shape), 'not ready !!' 1567 1574 print ' it only computes 3D [t,y,x] rank values' 1568 1575 quit(-1) 1569 1576 1570 return front 1577 return front, dt1tas, dd1wss, dt2tas, frontdims, frontvdims 1571 1578 1572 1579 ####### ###### ##### #### ### ## # END Fortran diagnostics -
trunk/tools/diagnostics.inf
r2390 r2655 17 17 fog, fog_RUC, QVAPOR@WRFt@WRFp 18 18 fog, fog_RUC, Q2@T2@PSFC 19 front, front_R04, T2@U10@V10@WRFdx@WRFdy@params:1.:0.0001 19 20 hur, LMDZrh, pres@t@r 20 21 hur, WRFrh, WRFrh@T@P@PB -
trunk/tools/diagnostics.py
r2643 r2655 103 103 # Variables not to check 104 104 NONcheckingvars = ['accum', 'cllmh', 'deaccum', 'face', 'LONLATdxdy', \ 105 ' reglonlatbnds', 'TSrhs', 'TStd', 'TSwds', 'TSwss',\105 'params', 'reglonlatbnds', 'TSrhs', 'TStd', 'TSwds', 'TSwss', \ 106 106 'WRFbils', 'WRFbnds', \ 107 107 'WRFclivi', 'WRFclwvi', 'WRFdens', 'WRFdx', 'WRFdxdy', 'WRFdxdywps', 'WRFdy', \ … … 167 167 WRFtime_compute = False 168 168 WRFz_compute = False 169 WRFdx_compute = False 170 WRFdx_compute = False 169 171 WRFdxdy_compute = False 170 172 WRFdxdywps_compute = False … … 194 196 if dnv == 'WRFtime': WRFtime_compute = True 195 197 if dnv == 'WRFz':WRFz_compute = True 198 if dnv == 'WRFdx':WRFdx_compute = True 199 if dnv == 'WRFdy':WRFdy_compute = True 196 200 if dnv == 'WRFdxdy':WRFdxdy_compute = True 197 201 if dnv == 'WRFdxdywps':WRFdxdywps_compute = True … … 225 229 if gen.searchInlist(depvars, 'WRFtime'): WRFtime_compute = True 226 230 if gen.searchInlist(depvars, 'WRFz'): WRFz_compute = True 231 if gen.searchInlist(depvars, 'WRFdx'): WRFdx_compute = True 232 if gen.searchInlist(depvars, 'WRFdy'): WRFdy_compute = True 227 233 if gen.searchInlist(depvars, 'WRFdxdy'): WRFdxdy_compute = True 228 234 if gen.searchInlist(depvars, 'WRFdxdywps'): WRFdxdywps_compute = True … … 410 416 'long_name': Vvals[4].replace('|',' '), 'units': Vvals[5]} 411 417 412 if WRFdxdy_compute :418 if WRFdxdy_compute or WRFdx_compute or WRFdy_copute: 413 419 print ' ' + main + ': Retrieving dxdy: real distance between grid points ' + \ 414 420 'from WRF as dx=(XLONG(i+1)-XLONG(i))*DX/MAPFAC_M, dy=(XLAT(j+1)-XLAT(i))*DY/'+\ … … 775 781 776 782 # front_R04: Computation of the presence of a front as defined by Rodrigues et al. 777 # (2004) ( vas, tas, dxs, dys)783 # (2004) (tas, uas, vas, dxs, dys, 'params',[dtas],[dwss]) 778 784 # Rodrigues et al. 2004: Climatologia de frentes frias no litoral de Santa Catarina, 779 785 # Rev. Bras. Geof. v.22 n.2 Sao Paulo maio/ago. DOI: 10.1590/S0102-261X2004000200004 … … 783 789 var1 = ncobj.variables[depvars[1]] 784 790 var2 = ncobj.variables[depvars[2]] 785 var3 = ncobj.variables[depvars[3]] 791 if depvars[3] == 'WRFdx': var3 = WRFdx 792 else: var3 = ncobj.variables[depvars[3]] 793 if depvars[4] == 'WRFdy': var4 = WRFdy 794 else: var4 = ncobj.variables[depvars[4]] 795 par1 = np.float(depvars[5].split(':')[1]) 796 par2 = np.float(depvars[5].split(':')[2]) 786 797 787 798 dnamesvar = list(var0.dimensions) 788 799 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 789 800 790 diag1, diagoutd, diagoutvd = diag.Forcompute_front_R04(var0, var1, \ 791 var2, var3, dnamesvar, dvnamesvar) 792 793 # Removing the nonChecking variable-dimensions from the initial list 794 varsadd = [] 795 diagoutvd = list(dvnames) 796 for nonvd in NONchkvardims: 797 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 798 varsadd.append(nonvd) 799 ncvar.insert_variable(ncobj, 'front', diag1, diagoutd, diagoutvd, newnc) 801 diag1, diag2, diag3, diag4, diagoutd, diagoutvd = diag.Forcompute_front_R04( \ 802 var0, var1, var2, var3, var4, par1, par2, dnamesvar, dvnamesvar) 803 804 # Removing the nonChecking variable-dimensions from the initial list 805 varsadd = [] 806 diagoutvd = list(dvnames) 807 for nonvd in NONchkvardims: 808 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 809 varsadd.append(nonvd) 810 ncvar.insert_variable(ncobj, 'front', diag1, diagoutd, diagoutvd, newnc, \ 811 fill=gen.fillValueF) 812 ovar = newnc.variables['front'] 813 ovar.setncattr('description', 'front defintion after a generalization of ' + \ 814 'Rodrigues et al. 2004, Rev. Bras. Geof. v.22 n.2, ' + \ 815 'doi: 10.1590/S0102-261X2004000200004') 816 ovar.setncattr('details1', 'N-S wind gradient replaced by gradient of uas, '+\ 817 'vas') 818 ovar.setncattr('dtas', par1) 819 ovar.setncattr('dwss', par2) 820 newnc.sync() 821 ncvar.insert_variable(ncobj, 'dt1', diag2, diagoutd, diagoutvd, newnc, \ 822 fill=gen.fillValueF) 823 ovar = newnc.variables['dt1'] 824 vu = var0.getncattr('units') 825 ncvar.set_attribute(ovar, 'units', vu) 826 attrv = ovar.getncattr('standard_name') 827 ncvar.set_attribute(ovar, 'standard_name', attrv + depvars[0]) 828 attrv = ovar.getncattr('long_name') 829 ncvar.set_attribute(ovar, 'long_name', attrv + ' of ' + depvars[0]) 830 ncvar.insert_variable(ncobj, 'gradh', diag3, diagoutd, diagoutvd, newnc, \ 831 fill=gen.fillValueF) 832 ovar = newnc.variables['gradh'] 833 vu = var1.getncattr('units') 834 ncvar.set_attribute(ovar, 'units', vu+'m-1') 835 attrv = ovar.getncattr('standard_name') 836 ncvar.set_attribute(ovar, 'standard_name', attrv + 'wss') 837 attrv = ovar.getncattr('long_name') 838 ncvar.set_attribute(ovar, 'long_name', attrv + ' of wss') 839 ncvar.insert_variable(ncobj, 'dt2', diag4, diagoutd, diagoutvd, newnc, \ 840 fill=gen.fillValueF) 841 vu = var0.getncattr('units') 842 ncvar.set_attribute(ovar, 'units', vu) 843 attrv = ovar.getncattr('standard_name') 844 ncvar.set_attribute(ovar, 'standard_name', attrv + depvars[0]) 845 attrv = ovar.getncattr('long_name') 846 ncvar.set_attribute(ovar, 'long_name', attrv + ' of ' + depvars[0]) 800 847 801 848 # LMDZrh (pres, t, r) -
trunk/tools/module_ForDiagnostics.f90
r2642 r2655 1550 1550 END SUBROUTINE compute_tws_RK4 1551 1551 1552 SUBROUTINE compute_front_R04d3(d1, d2, d3, tas, uas, vas, dsx, dsy, front) 1552 SUBROUTINE compute_front_R04d3(d1, d2, d3, tas, uas, vas, ddtas, ddwss, dsx, dsy, front, dt1tas, & 1553 dd1wss, d2tas) 1553 1554 ! Subroutine to compute presence of a front following Rodrigues et al.(2004), Rev. Bras. Geofis. 22, 1554 1555 ! 135-151 … … 1557 1558 1558 1559 INTEGER, INTENT(in) :: d1, d2, d3 1559 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(in) :: tas, uas, vas, dsx, dsy 1560 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(in) :: tas, uas, vas 1561 REAL(r_k), DIMENSION(d1,d2), INTENT(in) :: dsx, dsy 1562 REAL(r_k), INTENT(in) :: ddtas, ddwss 1560 1563 INTEGER, DIMENSION(d1,d2,d3), INTENT(out) :: front 1564 REAL(r_k), DIMENSION(d1,d2,d3), INTENT(out) :: dt1tas, dd1wss, d2tas 1561 1565 1562 1566 ! Local … … 1568 1572 ! dxs: grid spacing betweeen grid points along x-axis [m] 1569 1573 ! dys: grid spacing betweeen grid points along y-axis [m] 1574 ! ddtas: sensitivity to the thermal temporal increment [K] 1575 ! ddwss: sensitivity to the wind gradient [ms-1m-1] 1576 ! front: presence of a front in the grid point [-1: cold front, 0: no, 1: warm front] 1577 ! dt1tas: 1-time-step temporal gradient of tas 1578 ! dd1wss: first order divergence of winds 1579 ! dt2tas: 2-time-step temporal gradient of tas 1570 1580 1571 1581 fname = 'compute_front_R04d3' 1572 1582 1573 CALL var_front_R04(d1, d2, d3, tas, uas, vas, d sx, dsy, front)1583 CALL var_front_R04(d1, d2, d3, tas, uas, vas, ddtas, ddwss, dsx,dsy, front, dt1tas, dd1wss, d2tas) 1574 1584 1575 1585 RETURN -
trunk/tools/module_ForDiagnosticsVars.f90
r2642 r2655 1977 1977 END SUBROUTINE Svar_tws_S11 1978 1978 1979 SUBROUTINE var_front_R04(dx, dy, dt, tas, uas, vas, ddx, ddy, front) 1979 SUBROUTINE var_front_R04(dx, dy, dt, tas, uas, vas, dtas, dwss, ddx, ddy, front, dt1tas, dd1wss, & 1980 d2tas) 1980 1981 ! Subroutine to compute presence of a front following 1981 1982 ! Rodrigues et al.(2004), Rev. Bras. Geofis. 22, 135-151, doi: 10.1590/S0102-261X2004000200004 … … 1986 1987 REAL(r_k), DIMENSION(dx,dy), INTENT(in) :: ddx, ddy 1987 1988 REAL(r_k), DIMENSION(dx,dy,dt), INTENT(in) :: tas, uas, vas 1989 REAL(r_k), INTENT(in) :: dtas, dwss 1988 1990 INTEGER, DIMENSION(dx,dy,dt), INTENT(out) :: front 1991 REAL(r_k), DIMENSION(dx,dy,dt), INTENT(out) :: dt1tas, dd1wss, d2tas 1989 1992 1990 1993 ! Local 1991 1994 INTEGER :: i, j, l 1992 REAL, DIMENSION(dx,dy,dt) :: dt1uas, dt1vas, dt1tas, dc1wss, d2tas1995 ! REAL, DIMENSION(dx,dy,dt) :: dt1uas, dt1vas, dt1tas, dc1wss, d2tas 1993 1996 1994 1997 !!!!!!! Variables … … 1997 2000 ! uas: 10m eastward wind speed [ms-1] 1998 2001 ! vas: 10m northward wind speed [ms-1] 1999 ! front: presence of a front in the grid point [0: no, 1: yes] 2002 ! dtas: sensitivity to thermal temporal difference to determine presence of a front 2003 ! dwss: sensitivity to wind gradient to determine presence of a front 2004 ! front: presence of a front in the grid point [-1: cold front, 0: no, 1: warm front] 2005 ! dt1tas: 1-time-step temporal gradient of tas 2006 ! dd1wss: first order divergence of winds 2007 ! dt2tas: 2-time-step temporal gradient of tas 2000 2008 2001 2009 fname = 'var_front_R04' 2002 2010 2003 dt1uas = zeroRK 2004 dt1vas = zeroRK 2005 dt1tas = zeroRK 2006 dc1wss = zeroRK 2007 d2tas = zeroRK 2011 dt1tas = fillval64 2012 dd1wss = fillval64 2013 d2tas = fillval64 2008 2014 2009 2015 ! 1-time-step derivatives 2010 2016 DO l=1,dt-1 2011 dt1tas(:,:,l) = ABS(tas(:,:,l+1) - tas(:,:,l)) 2012 dt1vas(:,:,l) = ABS(vas(:,:,l+1) - vas(:,:,l)) 2017 dt1tas(:,:,l) = tas(:,:,l+1) - tas(:,:,l) 2013 2018 END DO 2014 2019 2015 ! First order curl2020 ! First order gradient 2016 2021 DO l=1,dt-1 2017 CALL curl2D_1o(dx,dy,ddx,ddy,uas(:,:,l),vas(:,:,l),dc1wss(:,:,l))2022 CALL divergence2D_1o(dx,dy,ddx,ddy,uas(:,:,l),vas(:,:,l),dd1wss(:,:,l)) 2018 2023 END DO 2019 2024 2020 ! 2-time-step centered derivatives2025 ! 2-time-step centered gradient 2021 2026 DO l=2,dt-1 2022 d2tas(:,:,l) = ABS(tas(:,:,l+1) - tas(:,:,l-1))2027 d2tas(:,:,l) = tas(:,:,l+1) - tas(:,:,l-1) 2023 2028 END DO 2024 2029 … … 2027 2032 DO i=1,dx 2028 2033 DO j=1,dy 2029 IF ( (dc1wss(i,j,l) /= zeroRK) .AND. (d2tas(i,j,l) > 0.5) ) front(i,j,l) = 1 2034 IF ( (ABS(dd1wss(i,j,l)) >= dwss) .AND. (ABS(d2tas(i,j,l)) >= dtas) ) THEN 2035 IF (d2tas(i,j,l) > 0.) THEN 2036 front(i,j,l) = oneRK 2037 ELSE 2038 front(i,j,l) = -oneRK 2039 END IF 2040 END IF 2030 2041 END DO 2031 2042 END DO -
trunk/tools/variables_values.dat
r2387 r2655 83 83 fbase, clmf, cloud_base_mass_flux, -0.3, 0.3, cloud|base|mass|flux, kgm-2s-1, seismic, $clmf$, clmf 84 84 LFBASE, clmf, cloud_base_mass_flux, -0.3, 0.3, cloud|base|mass|flux, kgm-2s-1, seismic, $clmf$, clmf 85 front, front, front, -1., 1., presence|of|front|(-1:|cold|front;|1:|warm|front), 1, seismic, $front$, front 85 86 clp, clp, cloud_base_pressure, -0.3, 0.3, cloud|base|pressure, Pa, Reds, $clp$, clp 86 87 pbase, clp, cloud_base_pressure, -0.3, 0.3, cloud|base|pressure, Pa, Reds, $clp$, clp … … 125 126 ds, ds, horizontal_grid_distance, 0., 200., total|distance|between|grid|points, m, Reds, $ds$, ds 126 127 WRFds, ds, horizontal_grid_distance, 0., 200., total|distance|between|grid|points, m, Reds, $ds$, ds 128 dt1, dt1, tendency, -3.e-3, 3.e-3, 1 time-step tendency, 1, seismic, $\Delta_{t}{\mathcal{X}}$, dt1 129 dt2, dt2, tendency, -3.e-3, 3.e-3, 2 time-steps tendency, 1, seismic, $\Delta2_{t}{\mathcal{X}}$, dt2 127 130 dta, dta, tendency_air_temperature, -3.e-3, 3.e-3, tendency|of|air|temperature, K/s, seismic, $\partial_{t}{ta}$, dtta 128 131 tnt, dta, tendency_air_temperature, -3.e-3, 3.e-3, tendency|of|air|temperature, K/s, seismic, $\partial_{t}{ta}$, dtta … … 192 195 EVSPSBLPOT, evspsblpot, potential_water_evapotranspiration_flux, 0., 1.5e-4, potential|evapotranspiration|flux, kgm-2s-1, Blues, $evspsblpot$, evspsblpot 193 196 fog, fog, fog, 0, 1, presence|of|fog|(0:no|1:yes), 1, Purples, $fog$, fog 197 gradh, gradh, gradient_horizontal, -3.e-3, 3.e-3, horizontal gradient, m-1, seismic, $\nabla\cdot{\mathcal{X}}$, /\. 194 198 g, g, grauepl_mixing_ratio, 0., 0.0003, graupel|mixing|ratio, kgkg-1, Purples, $qg$, qg 195 199 QGRAUP, g, grauepl_mixing_ratio, 0., 0.0003, graupel|mixing|ratio, kgkg-1, Purples, $qg$, qg
Note: See TracChangeset
for help on using the changeset viewer.