Changeset 1810 in lmdz_wrf


Ignore:
Timestamp:
Mar 16, 2018, 9:11:22 PM (7 years ago)
Author:
lfita
Message:

Adding WRFw' and WRFhus' on 'pinterp'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1781 r1810  
    1805118051def pinterp(values, ncfile, variables):
    1805218052    """ Function to vertically interpolate using subroutines from the p_interp.F90 NCAR program
    18053       Using fortran codes: module_generic.F90
    18054       foudre: f2py -m module_ForInterpolate --f90exec=/usr/bin/gfortran-4.7 -c module_generic.F90 module_ForInterpolate.F90  >& run_f2py.log
    18055       ciclad: f2py --f90flags="-fPIC" -L/opt/canopy-1.3.0/Canopy_64bit/System/lib/ -L/usr/lib64/ -L/opt/canopy-1.3.0/Canopy_64bit/System/lib/ -m module_ForInterpolate -c module_generic.F90 module_ForInterpolate.F90
    1805618053      values= [interplevs],[linloginterp],[extrap]
    1805718054        [interplevs]: ':' separated list of pressure values to interpolate [Pa] (decreassing in Pa)
     
    1806318060      variables = ',' separated list of names of variables to interpolate ('all', fo all 4D-atmospheric variables)
    1806418061        'WRFght': for WRF geopotential height
     18062        'WRFhus': for WRF specific humidity
    1806518063        'WRFrh': for WRF relative humidity
    1806618064        'WRFt': for WRF temperature
    1806718065        'WRFu': for WRF x-wind de-staggered
    1806818066        'WRFv': for WRF y-wind de-staggered
     18067        'WRFw': for WRF z-wind de-staggered
    1806918068    """
    1807018069    import module_ForInt as fin
     
    1835218351                isgeop = True
    1835318352                varattrs = gen.variables_values('WRFght')
     18353                CFvn = varattrs[0]
     18354                newvarattr['standard_name'] = varattrs[1]
     18355                newvarattr['long_name'] = varattrs[4].replace('|',' ')
     18356                newvarattr['units'] = varattrs[5]
     18357            elif vn == 'WRFhus':
     18358                # relative humidity
     18359                varin = qv/(1.+qv)
     18360                isgeop = False
     18361                varattrs = gen.variables_values('hus')
    1835418362                CFvn = varattrs[0]
    1835518363                newvarattr['standard_name'] = varattrs[1]
     
    1840118409                newvarattr['long_name'] = varattrs[4].replace('|',' ')
    1840218410                newvarattr['units'] = varattrs[5]
     18411            elif vn == 'WRFw':
     18412                ovarin = onc.variables['W']
     18413                print infmsg
     18414                print '  ' + fname + ': De-staggering z-wind variable !!'
     18415                print '    from:', ovarin.shape, 'to', (dimt, dimz, dimy, dimx)
     18416                varin = np.zeros((dimt, dimz, dimy, dimx), dtype=np.float64)
     18417                varin[:] = 0.5*(ovarin[:,0:dimz,:,:] + ovarin[:,1:dimz+1,:,:])
     18418                isgeop = False
     18419                varattrs = gen.variables_values('wa')
     18420                CFvn = varattrs[0]
     18421                newvarattr['standard_name'] = varattrs[1]
     18422                newvarattr['long_name'] = varattrs[4].replace('|',' ')
     18423                newvarattr['units'] = varattrs[5]
    1840318424            elif vn == 'pres':
    1840418425                varin = pres
Note: See TracChangeset for help on using the changeset viewer.