Changeset 2223 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Nov 9, 2018, 2:21:21 PM (6 years ago)
Author:
lfita
Message:

Adding to 'range_faces':

  • -2:|downhill;-1:|downhill-valley;|0:|peak|;1:|uphill-valley;2:|uphill
  • filtering outside any range
Location:
trunk/tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r2215 r2223  
    14001400        dy = hgt.shape[0]
    14011401
    1402         hgtmaxt, pthgtmaxt, dhgtt, peakst, valleyst, ofacest, ffacest, rnghgtmaxt,   \
    1403           ptrnghgtmaxt =                                                             \
     1402        hgtmaxt, pthgtmaxt, dhgtt, peakst, valleyst, ofacest, ffacest, rngt,         \
     1403          rnghgtmaxt, ptrnghgtmaxt =                                                 \
    14041404          fdin.module_fordiagnostics.compute_range_faces(lon=lon[:].transpose(),     \
    14051405          lat=lat[:].transpose(), hgt=hgt[:].transpose(), dist=ds[:].transpose(),    \
     
    14141414        origfaces = ofacest.transpose()
    14151415        filtfaces = ffacest.transpose()
     1416        ranges = rngt.transpose()
    14161417        rangeshgtmax = rnghgtmaxt.transpose()
    14171418        ptrangeshgtmax = ptrnghgtmaxt.transpose()
     
    14231424
    14241425    return hgtmax, pthgtmax, dhgt, peaks, valleys, origfaces, filtfaces, vardims,    \
    1425       varvdims, rangeshgtmax, ptrangeshgtmax
     1426      varvdims, ranges, rangeshgtmax, ptrangeshgtmax
    14261427
    14271428####### ###### ##### #### ### ## # END Fortran diagnostics
  • trunk/tools/diagnostics.py

    r2222 r2223  
    781781
    782782        orogmax, ptorogmax, dhgt, peaks, valleys, origfaces, diagout, diagoutd,      \
    783           diagoutvd, rngorogmax, ptrngorogmax = diag.Forcompute_range_faces(lon, lat,\
    784           hgt, WRFds, face, dsfilt, dsnewrange, hvalleyrange, dnamesvar, dvnamesvar)
     783          diagoutvd, rng, rngorogmax, ptrngorogmax= diag.Forcompute_range_faces(lon, \
     784           lat, hgt, WRFds, face, dsfilt, dsnewrange, hvalleyrange, dnamesvar,       \
     785           dvnamesvar)
    785786
    786787        # Removing the nonChecking variable-dimensions from the initial list
     
    798799        if face == 'WE': axis = 'lon'
    799800        elif face == 'SN': axis = 'lat'
     801
     802        ncvar.insert_variable(ncobj, 'range', rng, diagoutd, diagoutvd, newnc,       \
     803          fill=gen.fillValueI)
     804        ovar = newnc.variables['range']
     805        ncvar.set_attribute(ovar, 'deriv', axis)
    800806
    801807        ncvar.insert_variable(ncobj, 'orogmax', rngorogmax, diagoutd, diagoutvd,     \
  • trunk/tools/module_ForDiagnostics.f90

    r2217 r2223  
    950950
    951951  SUBROUTINE compute_range_faces(d1, d2, lon, lat, hgt, dist, face, dsfilt, dsnewrange, hvalrng,      &
    952     hgtmax, pthgtmax, derivhgt, peaks, valleys, origfaces, filtfaces, rangeshgtmax, ptrangeshgtmax)
     952    hgtmax, pthgtmax, derivhgt, peaks, valleys, origfaces, filtfaces, ranges, rangeshgtmax,           &
     953    ptrangeshgtmax)
    953954! Subroutine to compute faces [uphill, valleys, downhill] of a mountain range along a given face
    954955
     
    961962    REAL(r_k), DIMENSION(d1,d2), INTENT(out)             :: derivhgt, hgtmax, rangeshgtmax
    962963    INTEGER, DIMENSION(d1,d2), INTENT(out)               :: pthgtmax, origfaces, filtfaces, peaks,    &
    963       valleys, ptrangeshgtmax
     964      valleys, ranges, ptrangeshgtmax
    964965! Local
    965966    INTEGER                                              :: i, j
     
    988989! origfaces: original faces (-1, downhill; 0: valley; 1: uphill)
    989990! filtfaces: filtered faces (-1, downhill; 0: valley; 1: uphill)
     991! ranges: number of range
    990992! rangeshgtmax: maximum height for each individual range [m]
    991993! ptrangeshgtmax: grid point maximum height for each individual range [1]
     
    10121014        END DO
    10131015        DO i=1, Nranges
     1016          ranges(ranges1(1,i):ranges1(2,i),j) = i
    10141017          rangeshgtmax(ranges1(1,i):ranges1(2,i),j) = rangeshgtmax1(i)
    10151018          ptrangeshgtmax(irangeshgtmax1(i),j) = 1
     
    10301033        END DO
    10311034        DO j=1, Nranges
     1035          ranges(i,ranges2(1,j):ranges2(2,j)) = j
    10321036          rangeshgtmax(i,ranges2(1,j):ranges2(2,j)) = rangeshgtmax2(j)
    10331037          ptrangeshgtmax(i,irangeshgtmax2(j)) = 1
  • trunk/tools/module_ForDiagnosticsVars.f90

    r2217 r2223  
    16501650          faces0(i) = fillValI
    16511651        ELSE
    1652           faces0(i) = 1
     1652          faces0(i) = 2
    16531653        END IF
    16541654      ELSE IF (dhgt(i) < 0.) THEN
     
    16561656          faces0(i) = fillValI
    16571657        ELSE
    1658           faces0(i) = -1
     1658          faces0(i) = -2
    16591659        END IF
    16601660      ELSE
     
    17731773    !   face values before first range, removed: if dhgt[i] != 0. and i < range[1,1] --> face[i] = fillvalueI
    17741774    !   face values after last range, removed: if dhgt[i] != 0. and i < range[2,Nranges] --> face[i] = fillvalueI
     1775    !   Uphill valleys as 0.5: if face[i] == 0. and i < rangemax --> face[i] = 0.5
     1776    !   downhill valleys as 0.5: if face[i] == 0. and i > rangemax --> face[i] = -0.5
     1777    !   range peaks as 0. face[rangemax] = 0.
    17751778    DO i=1,Nranges
    17761779      DO j=ranges(1,i), ranges(2,i)
    17771780        IF (dhgt(j) > 0. .AND. j > irangeshgtmax(i)) faces0(j) = 0
    17781781        IF (dhgt(j) < 0. .AND. j < irangeshgtmax(i)) faces0(j) = 0
     1782        IF (faces0(j) == 0. .AND. j < irangeshgtmax(i)) faces0(j) = 1
     1783        IF (faces0(j) == 0. .AND. j > irangeshgtmax(i)) faces0(j) = -1
    17791784      END DO
     1785      faces0(irangeshgtmax(i)) = 0
    17801786    END DO
    17811787    IF (dhgt(j) /= 0. .AND. j < ranges(1,1)) faces0(j) = fillValI
    17821788    IF (dhgt(j) /= 0. .AND. j > ranges(2,Nranges)) faces0(j) = fillValI
     1789
     1790    ! Removing all that grid points outside any range
     1791    DO j=1, d
     1792      IF (j < ranges(1,1)) THEN
     1793        faces0(j) = fillValI
     1794      ELSE IF (j > ranges(2,Nranges)) THEN
     1795        faces0(j) = fillValI
     1796      ELSE
     1797        rangewithin = .FALSE.
     1798        DO i=1,Nranges
     1799          IF (j >= ranges(1,i) .AND. j <= ranges(2,i)) THEN
     1800            rangewithin = .TRUE.
     1801            EXIT
     1802          END IF
     1803        END DO
     1804        IF (.NOT.rangewithin) faces0(j) = fillValI
     1805      END IF
     1806    END DO
    17831807
    17841808    ! classification using filt.
  • trunk/tools/variables_values.dat

    r2215 r2223  
    401401r, r, rain_mixing_ratio, 0., 0.03, rain|mixing|ratio, KgKg-1, BuPu, $qr$, qr
    402402QRAIN, r, rain_mixing_ratio, 0., 0.03, rain|mixing|ratio, KgKg-1, BuPu, $qr$, qr
    403 rangefaces, rangefaces, range_faces, -1, 1, mountain|rage|faces|(-1:|downhill;|0:|valley|;1:|uphill), 1, seismic, $range^{faces}$,range_faces
    404 range_faces, rangefaces, range_faces, -1, 1, mountain|rage|faces|(-1:|downhill;|0:|valley|;1:|uphill), 1, seismic, $range^{faces}$,range_faces
     403range, range, range, 0, 10, mountain|range, 1, Blues, $range$,range
     404rangefaces, rangefaces, range_faces, -2, 2, mountain|range|faces|(-2:|downhill;-1:|downhill-valley;|0:|peak|;1:|uphill-valley;2:|uphill), 1, seismic, $range^{faces}$,range_faces
     405range_faces, rangefaces, range_faces, -2, 2, mountain|range|faces|(-2:|downhill;-1:|downhill-valley;|0:|peak|;1:|uphill-valley;2:|uphill), 1, seismic, $range^{faces}$,range_faces
    405406reinf_slope, rslope, slope, 0., 1., slope, -, rainbow, $slope$, slope
    406407r_field, r_field, r_field, 0., 96., r_field, 1, BuPu, $r^{field}$, rfield
Note: See TracChangeset for help on using the changeset viewer.