NCL Home > Documentation > Functions > CCSM

dpres_plevel_Wrap

Calculates the pressure layer thicknesses of a constant pressure level coordinate system.

Available in version 4.3.0 or later.

Prototype

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

	function dpres_plevel_Wrap (
		plev [*] : numeric,  
		psfc     : numeric,  
		ptop [1] : numeric,  
		iopt     : integer   
	)

	return_val  :  numeric

Arguments

plev

A one dimensional array containing the constant pressure levels. May be in ascending or descending order. Must have the same units as psfc.

psfc

A scalar or an array of up to three dimensions containing the surface pressure data in Pa or hPa (mb). The rightmost dimensions must be latitude and longitude. Must have the same units as plev.

ptop

A scalar specifying the top of the column. Must have the same units as plev.

iopt

Set to zero. Currently not used.

Return value

If psfc is a scalar the return variable will be a one-dimensional array the same size as plev; if psfc is two-dimensional [e.g. (lat,lon)] or three-dimensional [e.g. (time,lat,lon)] then the return array will have an additional level dimension: (lev,lat,lon) or (time,lev,lat,lon). The size of the lev dimension is the same as the size of plev. The returned type will be double if psfc is double, float otherwise.

Description

Calculates the layer pressure thickness of a constant pressure level system. It is analogous to dpres_hybrid_ccm for hybrid coordinates. At each grid point the sum of the pressure thicknesses equates to [psfc-ptop]. At each grid point, the returned values above ptop and below psfc will be set to psfc@_FillValue. If there is no psfc@_FillValue then the _FillValue will be set to 1e20. If ptop or psfc is between plev levels then the layer thickness is modifed accordingly. If psfc is set to _FillValue, all layer thicknesses are set to the appropriate _FillValue.

The primary purpose of this function is to return layer thicknesses to be used to weight observations for integrations.

See Also

dpres_plevel_Wrap , dpres_hybrid_ccm

Examples

Example 1 Consider a similar but more common usage. Read data from an ERA-40 (or NCEP) data set. Compute Latent heat energy.

    f   = addfile ("foo.ERA40.nc" , "r")
    lev = f->lev  ; (/  1,  2,  3,  5,   7, 10, 20, 30, \ 
                  ;    50, 70,100,150, 200,250,300,400, \
                  ;   500,600,700,775, 850,925,1000 /)

    Q   = f->Q    ; kg/kg      (time,lev,lat,lon)
    psfc= f->PS   ; PA         (time,lat,lon)

    lev = lev*100
    lev@units = "Pa"    ; to match PS

    ptop= 0             ; integrate 0==>psfc at each grid point

                        ; dp(ntim,klev,nlat,mlon)
    dp  = dpres_plevel_Wrap(lev, psfc, ptop, 0)


                      ; latent heat of vaporization at 0C
    L   = 2.5e6       ; J/kg         [ m2/s2 ]

                           ; integrate vertically
                           ; LE(ntim,nlat,mlon)
    LE  = (L/GR)*dim_sum( Q*dp )   
    LE@long_name = "Latent Energy:  SUM[L*Q*dp]/g"
    LE@units     = "kg/s2"
                                    ; not necessary but useful
    LE  =  copy_VarCoords(psfc, LE) ; contributed.ncl   

    printVarSummary( LE )