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 )

*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)

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?