Changeset 2209 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Nov 1, 2018, 3:58:02 PM (6 years ago)
Author:
lfita
Message:

Adding `range_faces'

Location:
trunk/tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r2208 r2209  
    4141# Forcompute_psl_ptarget: Function to compute the sea-level pressure following
    4242#   target_pressure value found in `p_interp.F'
     43# Forcompute_range_faces: Function to compute faces [uphill, valley, downhill] of sections of a
     44#   mountain rage, along a given face
    4345# Forcompute_zmla_gen: Function to compute the boundary layer height following a
    4446#   generic method with Fortran
     
    13841386    varvdims = dimvns[:]
    13851387
    1386     if len(var.shape) == 2:
    1387         faces = np.zeros((var.shape[0],var.shape[1]), dtype=np.float)
    1388         dx = var.shape[1]
    1389         dy = var.shape[0]
     1388    if len(hgt.shape) == 2:
     1389        faces = np.zeros(hgt.shape, dtype=np.float)
     1390        dx = hgt.shape[1]
     1391        dy = hgt.shape[0]
    13901392
    13911393        facest=fdin.module_fordiagnostics.compute_range_faces(lon=lon[:].transpose(),\
  • trunk/tools/diagnostics.py

    r2208 r2209  
    2727# compute_OMEGAw: Function to transform OMEGA [Pas-1] to velocities [ms-1]
    2828# compute_prw: Function to compute water vapour path (prw)
     29# compute_range_faces: Function to compute faces [uphill, valley, downhill] of sections of a mountain
     30#   range, along a given face
    2931# compute_rh: Function to compute relative humidity following 'Tetens' equation (T,P) ...'
    3032# compute_td: Function to compute the dew point temperature
     
    8890    #######
    8991availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'convini', 'deaccum', 'fog_K84', \
    90   'fog_RUC', 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT',                                  \
     92  'fog_RUC', 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT', 'range_faces',                   \
    9193  'rvors', 'td', 'timemax', 'timeoverthres', 'turbulence', 'uavaFROMwswd',           \
    9294  'WRFcape_afwa', 'WRFclivi', 'WRFclwvi', 'WRF_denszint', 'WRFgeop',                 \
     
    99101
    100102# Variables not to check
    101 NONcheckingvars = ['accum', 'cllmh', 'deaccum', 'TSrhs', 'TStd', 'TSwds', 'TSwss',   \
     103NONcheckingvars = ['accum', 'cllmh', 'deaccum', 'face:WE', 'face:SN', 'TSrhs',       \
     104  'TStd', 'TSwds', 'TSwss',                                                          \
    102105  'WRFbils',                                                                         \
    103106  'WRFclivi', 'WRFclwvi', 'WRFdens', 'WRFgeop',                                      \
     
    676679        ncvar.insert_variable(ncobj, 'hurs', diagout, diagoutd, diagoutvd, newnc)
    677680
    678 # range_faces: LON, LAT, HGT, 'face,[WE],[SN]'
     681# range_faces: LON, LAT, HGT, 'face:['WE'/'SN']'
    679682    elif diagn == 'range_faces':
    680683           
     
    682685        var1 = ncobj.variables[depvars[1]][:]
    683686        var2 = ncobj.variables[depvars[2]][:]
    684         var3 = depvars[3].split(',')[1]
     687        var3 = depvars[3].split(':')[1]
     688
     689        lon, lat = gen.lonlat2D(var0, var1)
     690        if len(var2.shape) == 3:
     691            print warnmsg
     692            print '  ' + diagn + ": shapping to 2D variable '" + depvars[2] + "' !!"
     693            hgt = var2[0,:,:]
     694        else:
     695            hgt = var2[:]
    685696
    686697        dnamesvar = list(ncobj.variables[depvars[0]].dimensions)
    687698        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
    688699
    689         diagout, diagoutd, diagoutvd = diag.Forcompute_range_faces(var0, var1, var2, \
     700        diagout, diagoutd, diagoutvd = diag.Forcompute_range_faces(lon, lat, hgt,    \
    690701          var3, dnamesvar, dvnamesvar)
    691702
  • trunk/tools/module_ForDiagnostics.f90

    r2208 r2209  
    2727! compute_fog_RUC: Computation of fog and visibility following RUC method Smirnova, (2000)
    2828! compute_fog_FRAML50: fog and visibility following Gultepe and Milbrandt, (2010)
     29! compute_massvertint1D: Subroutine to vertically integrate a 1D variable in eta vertical coordinates
    2930! compute_psl_ecmwf: Compute sea level pressure using ECMWF method following Mats Hamrud and Philippe Courtier [Pa]
    30 ! compute_massvertint1D: Subroutine to vertically integrate a 1D variable in eta vertical coordinates
     31! compute_range_faces: Subroutine to compute faces [uphill, valleys, downhill] of a mountain range along a given face
    3132! compute_vertint1D: Subroutine to vertically integrate a 1D variable in any vertical coordinates
    3233! compute_zint4D: Subroutine to vertically integrate a 4D variable in any vertical coordinates
  • trunk/tools/module_ForDiagnosticsVars.f90

    r2208 r2209  
    3535! var_potevap_orPM: potential evapotranspiration following Penman-Monteith formulation implemented in ORCHIDEE
    3636! var_psl_ecmwf: sea level pressure using ECMWF method following Mats Hamrud and Philippe Courtier [Pa]
     37! var_range_faces: compute faces [uphill, valleys, downhill] of a monuntain range along a face
    3738! var_rh: Subroutine to compute relative humidity following 'Tetens' equation (T,P) ...'
    3839! var_zmla_generic: Subroutine to compute pbl-height following a generic method
     
    15791580
    15801581  SUBROUTINE var_range_faces(d, lon, lat, hgt, faces)
    1581 ! Subroutine to compute faces of a monuntain range along a face
     1582! Subroutine to compute faces [uphill, valleys, downhill] of a monuntain range along a face
    15821583
    15831584    IMPLICIT NONE
     
    16191620      IF (dhgt(i) > 0.) THEN
    16201621        faces(i) = 1
    1621       ELSE
     1622      ELSE IF (dhgt(i) < 0.) THEN
    16221623        faces(i) = -1
     1624      ELSE
     1625        faces(i) = 0
    16231626      END IF
    16241627      ! peaks
     
    16341637
    16351638    ! tendency of the slope
    1636     ddhgt(1) = 1 
     1639    ddhgt(1) = 1
    16371640    Nfaces = 1
    16381641    Ndhgt(Nfaces) = 1
    16391642    DO i=2, d-1
    16401643      IF (faces(i) /= faces(i-1)) THEN
    1641         ddhgt(i) = ddhgt(i-1) + 1
    16421644        Nfaces = Nfaces + 1
    16431645        Ndhgt(Nfaces) = 1
     1646        ddhgt(i) = ddhgt(i-1) + 1
    16441647      ELSE
    16451648        Ndhgt(Nfaces) = Ndhgt(Nfaces) + 1
     1649        ddhgt(i) = ddhgt(i-1)
    16461650      END IF
    16471651    END DO
    16481652
    1649     PRINT *, 'ddhgt:', ddhgt
    16501653    PRINT *, Nfaces, ' length faces:', Ndhgt(1:Nfaces)
     1654
     1655    PRINT *, '# lon[0] lat[1] heights[2] slope[3] faces[4] ddhgt[5]'
     1656    DO i=1, d
     1657      PRINT *, lon(i), lat(i), hgt(i), dhgt(i), faces(i), ddhgt(i)
     1658    END DO
    16511659
    16521660    RETURN
  • trunk/tools/variables_values.dat

    r2140 r2209  
    389389r, r, rain_mixing_ratio, 0., 0.03, rain|mixing|ratio, KgKg-1, BuPu, $qr$, qr
    390390QRAIN, r, rain_mixing_ratio, 0., 0.03, rain|mixing|ratio, KgKg-1, BuPu, $qr$, qr
     391rangefaces, rangefaces, range_faces, -1, 1, mountain|rage|faces|(-1:|downhill;|0:|valley|;1:|uphill), 1, seismic, $range^{faces}$,range_faces
     392range_faces, rangefaces, range_faces, -1, 1, mountain|rage|faces|(-1:|downhill;|0:|valley|;1:|uphill), 1, seismic, $range^{faces}$,range_faces
    391393reinf_slope, rslope, slope, 0., 1., slope, -, rainbow, $slope$, slope
    392394r_field, r_field, r_field, 0., 96., r_field, 1, BuPu, $r^{field}$, rfield
Note: See TracChangeset for help on using the changeset viewer.