
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.
function cz2ccm(
ps : float,
phis : float,
tv : float,
p0 : float,
hyam : float,
hybm : float,
hyai : float,
hybi : float
)
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
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
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?