cz2ccm
Computes geopotential height for a CCM2 hybrid coordinates.
Note: This function is only available in version 4.1.1 of
NCL. If your site is licensed for version 4.1, then you can get
version 4.1.1 for free. To get version 4.1.1 of NCAR Graphics
software, please contact your site representative. If you don't know
who your site representative is, then send email to ncarginf@ucar.edu or call (303)
497-1201.
Synopsis
function cz2ccm(
ps : float,
phis : float,
tv : float,
p0 : float,
hyam : float,
hybm : float,
hyai : float,
hybi : float
)
Arguments
- ps
- input, surface pressure (Pascals). The rightmost dimensions should
correspond to latitute (nlat) and longitude (mlon).
- phis
- input, surface geopotential (m^2/s^2). A 2-dimensional array dimensioned
nlat x mlon. Note: if the utility "ccm2nc" was
used to convert the original CCM History Tape file to netCDF, this
field may have a time dimension of length one. In this case, just use
the first time stamp: "phis(0,:,:)" as the argument to the function.
- tv
- input, virtual temperature. The rightmost three dimensions must correspond to
klev, nlat, and mlon.
- p0
- scalar, input, hybrid base pressure (Pascals). It not available, use
100000.
- hyam
- hybrid coord coefficients for base pressure (layer midpoints;
ground to top)
- hybm
- hybrid coordinate coefficients for surface pressure (layer midpoints;
ground to top)
- hyai
- hybrid coordinate coefficients for base pressure (layer interfaces;
ground to top)
- hybi
- hybrid coordinate coefficients for surface pressure (layer interfaces;
ground to top)
Description
cz2ccm calculates geopotential heights for a CCM2 hybrid
coordinate system. Note that the hybrid coefficients are ordered
ground-to-top (which is the conventional way). Missing values are not
allowed. If any of the input arrays have the missing value attribute
"_FillValue" set, then a warning message will be printed.
Note: This is the *exact* routine used within the CCM
Processor.
Example 1
This example reads two files. The first one contains information the
second file does not contain. The second file contains daily means of
numerous variables for one month (30 time steps). The temperature (T)
and specific humidities (Q) are read directly from the file (f->T and
f->Q) and are used to calculate the virtual temperature: tv
with dimensions time x lev x lat lon.
Invoking cz2ccm as indicated below will dynamically return
the geopotential heights to z2 [time, lev,
lat, lon]. Note that the order of the hybrid coordinates
has been temporarily reversed [(::-1)] for the hybrid coefficients to
match the input requirements.
begin
diri = "/fs/scd/home1/shea/ncldata_input/"
filphis = "01-50.nc" ; file with PHIS field
f = addfile (diri+filphis+".nc" , "r")
; strip off various fields
phis = f->PHIS ; read PHIS to memory
lat = f->lat
lon = f->lon
lev = f->lev
ilev = f->ilev
hyam = f->hyam
hybm = f->hybm
hyai = f->hyai
hybi = f->hybi
mlon = dimsizes(lon)
nlat = dimsizes(lat)
klev = dimsizes(lev)
delete (f) ; not required but good programming practice
fili = (/ "ha0001.nc" /)
f = addfile (diri+fili , "r") ; daily files
ntimes = dimsizes(f->time) ; determine no. time steps (30)
ps = f->PS ; get sfc pres
tv = f->T*(1.+0.61*f->Q) ; calculate virtual temperature
p0 = f->P0 ; get constant
; calculate z2 at all 30 time steps
z2 = cz2ccm(ps, phis, tv, p0 \
,hyam(::-1), hybm(::-1), hyai(::-1), hybi(::-1) )
end
Example 2
This is a variation of the previous example. The goal is to get
geopotential heights at specified pressure levels after calculating
z2 at the hybrid levels. This uses the NCL function "vinth2p" to do the vertical
interpolation.
begin
[snip part one above]
fili = (/ "ha0001.nc" /)
f = addfile (diri+fili , "r") ; daily files
ntimes = dimsizes(f->time) ; determine no. time steps (30)
klvl = dimsizes(f->lev)
nlat = dimsizes(f->lat)
mlon = dimsizes(f->lon)
ps = f->PS ; get sfc pres
tv = f->T*(1.+0.61*f->Q) ; calculate virtual temperature
p0 = f->P0 ; get constant
; calculate Z2 at all 30 time steps
Z2 = cz2ccm(ps, phis, tv, p0 \ ; (time,lev,lat,lon)
,hyam(::-1), hybm(::-1), hyai(::-1), hybi(::-1) )
pnew = (/ 850., 500., 200. /) ; desired output levels [mb]
knew = dimsizes(pnew)
P0mb = 1000. ; reference pressure [mb]
Znew = new ( (/ntimes,knew,nlat,mlon/) , float)
do nt=0,ntimes-1 ; step thru each time step
Znew(nt,:,:,:) = vinth2p (Z2(nt,:,:,:) ,hyam, hybm, pnew ,ps, 1 ,P0mb, 2, True)
end do
end
Reference Manual Control Panel
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?
$Revision: 1.3 $ $Date: 1999/03/18 22:39:00 $