Changeset 2643 in lmdz_wrf


Ignore:
Timestamp:
Jun 28, 2019, 9:42:25 PM (5 years ago)
Author:
lfita
Message:

Adding:

  • Computing of front following Rodrigues et al 2004
Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r2619 r2643  
    4141# Forcompute_fog_RUC: Computation of fog and visibility following RUC method Smirnova, (2000)
    4242# Forcompute_fog_FRAML50: fog and visibility following Gultepe and Milbrandt, (2010)
     43# Forcompute_front_R04: Function to compute front following Rodrigues et al.(2004)
    4344# Forcompute_potevap_orPM: Function to compute potential evapotranspiration following
    4445#   Penman-Monteith formulation implemented in ORCHIDEE
     
    15311532    return hgtmax, pthgtmax, dhgt, peaks, valleys, origfaces, filtfaces, vardims,    \
    15321533      varvdims, ranges, rangeshgtmax, ptrangeshgtmax
     1534
     1535def Forcompute_front_R04(tas, uas, vas, dxs, dys, dimns, dimvns):
     1536    """ Function to compute front following Rodrigues et al.(2004), Rev. Bras.
     1537          Geofis. 22, 135-151
     1538    Forcompute_front_R04(tas, vas, dimns, dimvns)
     1539      [tas]= surface air-temperature values (assuming [[t],y,x]) [K]
     1540      [uas]= latitudinal wind (assuming [[t],y,x]) [ms-1]
     1541      [vas]= meridional wind (assuming [[t],y,x]) [ms-1]
     1542      [dxs]= grid spacing between grid points along x-axis (assuming [y,x]) [m]
     1543      [dys]= grid spacing between grid points along y-axis (assuming [y,x]) [m]
     1544      [dimns]= list of the name of the dimensions of [pa]
     1545      [dimvns]= list of the name of the variables with the values of the
     1546        dimensions of [pa]
     1547    """
     1548    fname = 'Forcompute_front_R04'
     1549
     1550    psldims = dimns[:]
     1551    pslvdims = dimvns[:]
     1552
     1553    if len(pa.shape) == 3:
     1554        front = np.zeros((tas.shape[0],tas.shape[1],tas.shape[2]), dtype=np.float)
     1555
     1556        dx = tas.shape[2]
     1557        dy = tas.shape[1]
     1558        dt = tas.shape[0]
     1559
     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)
     1563        front = pfront.transpose()
     1564    else:
     1565        print errormsg
     1566        print '  ' + fname + ': rank', len(pa.shape), 'not ready !!'
     1567        print '  it only computes 3D [t,y,x] rank values'
     1568        quit(-1)
     1569
     1570    return front
    15331571
    15341572####### ###### ##### #### ### ## # END Fortran diagnostics
  • trunk/tools/diagnostics.py

    r2621 r2643  
    9090    #######
    9191availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'convini', 'deaccum', 'fog_K84', \
    92   'fog_RUC', 'rhs_tas_tds', 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT', 'range_faces',    \
     92  'fog_RUC', 'front_R04', 'rhs_tas_tds', 'LMDZrh', 'mslp', 'OMEGAw', 'RAINTOT',      \
     93  'range_faces',                                                                     \
    9394  'rvors', 'td', 'timemax', 'timeoverthres', 'turbulence', 'tws', 'uavaFROMwswd',    \
    9495  'WRFbnds', 'WRFcape_afwa', 'WRFclivi', 'WRFclwvi', 'WRF_denszint', 'WRFgeop',      \
     
    773774        ncvar.insert_variable(ncobj, 'fogvisblty', diag2, diagoutd, diagoutvd, newnc)
    774775
     776# front_R04: Computation of the presence of a front as defined by Rodrigues et al.
     777#     (2004) (vas, tas, dxs, dys)
     778#   Rodrigues et al. 2004: Climatologia de frentes frias no litoral de Santa Catarina,
     779#     Rev. Bras. Geof. v.22 n.2 Sao Paulo maio/ago. DOI: 10.1590/S0102-261X2004000200004 
     780    elif diagn == 'front_R04':
     781
     782        var0 = ncobj.variables[depvars[0]]
     783        var1 = ncobj.variables[depvars[1]]
     784        var2 = ncobj.variables[depvars[2]]
     785        var3 = ncobj.variables[depvars[3]]
     786
     787        dnamesvar = list(var0.dimensions)
     788        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     789
     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)
     800
    775801# LMDZrh (pres, t, r)
    776802    elif diagn == 'LMDZrh':
Note: See TracChangeset for help on using the changeset viewer.