Changeset 2619 in lmdz_wrf
- Timestamp:
- Jun 19, 2019, 9:14:48 PM (5 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r2391 r2619 1142 1142 z=zpl[:].transpose(), hgt=hgt.transpose(), d1=dx, d2=dy, d3=dz, d4=dt) 1143 1143 zmla = pzmla.transpose() 1144 1145 elif len(theta.shape) == 2: 1146 zmla= np.zeros((theta.shape[0], theta.shape[1]), dtype=np.float) 1147 1148 dz = theta.shape[1] 1149 dt = theta.shape[0] 1150 zmladims.pop(1) 1151 zmlavdims.pop(1) 1152 1153 pzmla= fdin.module_fordiagnostics.compute_zmla_generic2d( \ 1154 tpot=theta[:].transpose(), qratio=qratio[:].transpose(), \ 1155 z=zpl[:].transpose(), hgt=hgt, d1=dz, d2=dt) 1156 zmla = pzmla.transpose() 1157 1144 1158 else: 1145 1159 print errormsg -
trunk/tools/diagnostics.py
r2390 r2619 2120 2120 ncvar.insert_variable(ncobj, 'vaz', diagout2, diagoutd, diagoutvd, newnc) 2121 2121 2122 # zmla_gen generic boundary layer hieght computation from generic 2D-file theta, qv, zg, orog, 2123 elif diagn == 'zmlagen': 2124 var0 = ncobj.variables[depvars[0]][:] 2125 var1 = ncobj.variables[depvars[1]][:] 2126 dimz = var0.shape[1] 2127 var2 = ncobj.variables[depvars[2]][:] 2128 var3 = ncobj.variables[depvars[3]][:] 2129 2130 diagout, diagoutd, diagoutvd = diag.Forcompute_zmla_gen(var0,var1,var2,var3, \ 2131 dnames,dvnames) 2132 2133 # Removing the nonChecking variable-dimensions from the initial list 2134 varsadd = [] 2135 for nonvd in NONchkvardims: 2136 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 2137 varsadd.append(nonvd) 2138 2139 ncvar.insert_variable(ncobj, 'zmla', diagout, diagoutd, diagoutvd, newnc) 2140 2141 # zmla_genUWsnd generic boundary layer hieght computation from UWyoming sounding file theta, qv, zg 2142 elif diagn == 'zmlagenUWsnd': 2143 var0 = ncobj.variables[depvars[0]][:] 2144 var1 = ncobj.variables[depvars[1]][:] 2145 dimz = var0.shape[1] 2146 var2 = ncobj.variables[depvars[2]][:] 2147 var3 = ncobj.getncattr('Station_elevation') 2148 2149 # Wrong order of dimensions ! 2150 var0 = var0.transpose() 2151 var1 = var1.transpose() 2152 var2 = var2.transpose() 2153 2154 diagout, diagoutd, diagoutvd = diag.Forcompute_zmla_gen(var0,var1,var2,var3, \ 2155 dnames,dvnames) 2156 2157 # Removing the nonChecking variable-dimensions from the initial list 2158 varsadd = [] 2159 for nonvd in NONchkvardims: 2160 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 2161 varsadd.append(nonvd) 2162 2163 ncvar.insert_variable(ncobj, 'zmla', diagout, diagoutd, diagoutvd, newnc) 2164 2122 2165 else: 2123 2166 print errormsg -
trunk/tools/module_ForDiagnostics.f90
r2387 r2619 691 691 692 692 END SUBROUTINE compute_zmla_generic4D 693 694 SUBROUTINE compute_zmla_generic2D(tpot, qratio, z, hgt, zmla1D, d1, d2) 695 ! Subroutine to compute pbl-height following a generic method 696 ! from Nielsen-Gammon et al., 2008 J. Appl. Meteor. Clim. 697 ! applied also in Garcia-Diez et al., 2013, QJRMS 698 ! where 699 ! "The technique identifies the ML height as a threshold increase of potential temperature from 700 ! its minimum value within the boundary layer." 701 ! here applied similarly to Garcia-Diez et al. where 702 ! zmla = "...first level where potential temperature exceeds the minimum potential temperature 703 ! reached in the mixed layer by more than 1.5 K" 704 705 IMPLICIT NONE 706 707 INTEGER, INTENT(in) :: d1, d2 708 REAL(r_k), DIMENSION(d1,d2), INTENT(in) :: tpot, qratio, z 709 REAL(r_k), INTENT(in) :: hgt 710 REAL(r_k), DIMENSION(d2), INTENT(out) :: zmla1D 711 712 ! Local 713 INTEGER :: it, iz, newd1, newd2, newd3, mind 714 REAL(r_k), DIMENSION(d1) :: var1, var2, var3 715 CHARACTER(len=3) :: newd1S, newd2S, newd3S, itS 716 717 !!!!!!! Variables 718 ! tpot: potential air temperature [K] 719 ! qratio: water vapour mixing ratio [kgkg-1] 720 ! z: height above sea level [m] 721 ! hgt: terrain height [m] 722 ! zmla1D: boundary layer height from surface [m] 723 724 fname = 'compute_zmla_generic2D' 725 726 DO it=1, d2 727 ! Removing missing value 728 CALL rm_values_vecRK(d1, qratio(:,it), fillval64, newd1, var1) 729 CALL rm_values_vecRK(d1, tpot(:,it), fillval64, newd2, var2) 730 CALL rm_values_vecRK(d1, z(:,it), fillval64, newd3, var3) 731 732 IF ( newd1 /= 0 .AND. newd2 /= 0 .AND. newd3 /= 0) THEN 733 IF ((newd1 /= newd2) .OR. (newd1 /= newd3)) THEN 734 WRITE(itS, '(I3)')it 735 WRITE(newd1S, '(I3)')newd1 736 WRITE(newd2S, '(I3)')newd2 737 WRITE(newd3S, '(I3)')newd3 738 msg = "At it= " // TRIM(itS) //" Not coindident amount of levels for all 3 variables " // & 739 "qratio: " // TRIM(newd1S) //", tpot: " // TRIM(newd2S) //" and z: " // TRIM(newd3S) 740 PRINT *, TRIM(msg) 741 ! Filtering only for simultaneous valid values 742 newd1 = 0 743 DO iz=1, d1 744 IF ((qratio(iz,it) /= fillval64) .AND. (tpot(iz,it) /= fillval64) .AND. & 745 (z(iz,it) /= fillval64)) THEN 746 newd1 = newd1 + 1 747 var1(newd1)= qratio(iz,it) 748 var2(newd1)= tpot(iz,it) 749 var3(newd1)= z(iz,it) 750 END IF 751 END DO 752 newd2 = newd1 753 newd3 = newd1 754 END IF 755 CALL var_zmla_generic(newd1, var1(1:newd1), var2(1:newd2), var3(1:newd3), hgt, zmla1D(it)) 756 ELSE 757 zmla1D(it) = fillval64 758 END IF 759 END DO 760 761 RETURN 762 763 END SUBROUTINE compute_zmla_generic2D 693 764 694 765 SUBROUTINE compute_zwind4D(ua, va, z, uas, vas, sina, cosa, zextrap, uaz, vaz, d1, d2, d3, d4)
Note: See TracChangeset
for help on using the changeset viewer.