NCL Home > Documentation > Functions > CESM

dpres_hybrid_ccm_se

Calculates the pressure layer thickness at each mid-layer hybrid level for the spectral element model.

Prototype

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
                                                             ; from NCL V6.2.0 onward.
                                                             ; No need for user to explicitly load.

	function dpres_hybrid_ccm_se (
		ps       : numeric,  
		p0   [1] : numeric,  
		hyai [*] : numeric,  
		hybi [*] : numeric   
	)

	return_val  :  numeric

Arguments

ps

An array of at least 2 dimensions equal to surface pressure data in Pa or hPa (mb). The rightmost dimension must reference locations: eg, ps(time,ncol) or ps(ncol).

p0

A scalar value equal to the surface reference pressure. Must have the same units as ps.

Return value

Let dimsizes(hyai)=nlevi. If ps(ntim,ncol) or ps(ncol), then the return array (say, dp) will have an additional level dimension: dp(ntim,nlevi-1,ncol) or dp(nlevi-1,ncol). The returned type will be double if ps is double, float otherwise.

Description

Calculates the pressure layer thicknesses at each grid point of a hybrid coordinate system on a spectral element (se) grid. This equates to the absolute value of the pressure difference between adjacent hybrid levels at each grid point.

See Also

dpres_plevel, dpres_plevel_Wrap, pres_hybrid_ccm_se

Examples

Example 1

hyai and hybi are one-dimensional arrays of length klvli, ps is a two-dimensional array ps(ntim,ncol) in units of pascals. The returned array will be thcree-dimensional with dimension sizes (ntim,klvli-1,ncol).

 
  hyai = f->hyai ; read from a file the interface hybrid coefficients
  hybi = f->hybi ; read from a file
  ps   = f->PS   ; surface pressure [Pa]; (time,ncol)   
  p0   = 100000. ; since ps is in Pa 

  dph = dpres_hybrid_ccm_se(ps,p0,hyai,hybi)   ; dph(time,lev,ncol)   
Example 2

The same as example 1, but calculated in a loop. At each iteration the returned variable, dph, will be size (klvl-1,nlat,mlon)

  do nt=0,ntim-1
     dph = dpres_hybrid_ccm_se(ps(nt,:,:),p0,hyai,hybi)  
     ...
     ...
  end do
Example 3

Perform vertical integration of T to determine the internal energy. Note that dimension reordering is used to make "lev" the rightmost dimension.

  f = addfile("....", "r")
  hyai = f->hyai
  hybi = f->hybi
  p0   = f->P0
  ps   = f->PS

  dp   = dpres_hybrid_ccm_se (ps,p0,hyai,hybi)  ; Pa [kg/(m s2)]   

  T    = f->T                                ; K  (time,lev,lat,lon)
  cp   = 1004.                               ; J/(K kg)     [ m2/(K s2) ]
  g    = 9.81                                ; m/s

  Tdp  = T*dp                                ; [K kg/(m s2)]   (temporary variable)
  copy_VarCoords(T, Tdp)
                   ; vertical sum [ie integrate]
  IE   = dim_sum_n_Wrap( Tdp, 1)  
                   ; Internal Energy (time,lat,lon)
  IE   = cp*IE/g                             ; kg/s2  
  IE@long_name = "Vertically Integrated Internal Energy"
  IE@units     = "kg/s2"

  IE_tavg = dim_avg_n_Wrap( IE, 0)
  IE@long_name = "Time Average: Vertically Integrated Internal Energy"

  printVarSummary(IE)
  printMinMax(IE, True)
  printVarSummary(IE_tavg)
  printMinMax(IE_tavg, True)

  delete(Tdp)    ; no longer needed