Re: question on NCL function cz2ccm

From: Dennis Shea (shea AT XXXXXX)
Date: Thu Oct 21 2004 - 09:33:16 MDT

  • Next message: Jianping Pan: "Re: question on NCL function cz2ccm"

    >Dear Friends,

    >I am a little bit confused on the usage of cz2ccm function in NCL, it's stated
    as

    >function cz2ccm(
            ps : numeric,
            phis : numeric,
            tv : numeric,
            p0 : numeric,
            hyam : numeric,
            hybm : numeric,
            hyai : numeric,
            hybi : numeric)

    >and hyam, hybm, hyai, hybi: input, hybrid coordinate coefficients for base
    >pressure (layer midpoints; ground to top), and there's no description for other
    >variables.

    >I am wondering what's the direction of "tv" should like to be, as it also has a
    >direction in the vertical level. For the output "HGT", there also is a
    >direction concern.
    >Thanks a lot for your help!

    Hello Jianping

    This function is directly from the old (now unsupported) CCM Processor.
    It calculates geopotential heights for older versions of the
    AGCM that did not output geopotential height. Current versions output
    the "Z3" variable.

    Functions that are directly from the CCM Processor
    (eg, cz2ccm, vinth2p, ..) require top-to-bottom order where "bottom"
    refers to the near surface level.

    This can be confusing because the hybrid coefficients on the
    files are from bottom-to-top while variable like temperature
    and specific humidity which are used to calculate
    virtual temperatue (tv) are from top-to-bottom.

    Note from example 1:

      z2 = cz2ccm(ps, phis, tv, p0 \
                 ,hyam(::-1), hybm(::-1), hyai(::-1), hybi(::-1) )

    The (::-1) syntax is NCL's succinct way of reversing the order
    of a variables dimension. This make all the hybrid variables
    go from top-to-bottom and is consistent with "tv".

    The output is from top-to-bottom.

    --
    After invoking the cz2ccm function you may wish to create
    and copy appropriate mata dat (attributes, coordinate variables).
    

    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" 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(0,:,:) ; 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

    fili = (/ "ha0001.nc" /) f = addfile (diri+fili , "r") ; daily files ps = f->PS ; get sfc pres T = f->T tv = 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) )

    z2@long_name = "geopotential height" z2@units = "gpm" copy_VarCoords(T,z2) ; contributed printVarSummary(z2) delete(T) ; *not* required delete(tv) ; delete if memory is a concern delete(ps) ; and you do not need these variables delete(phis) [snip] end

    _______________________________________________ ncl-talk mailing list ncl-talk AT ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Thu Oct 21 2004 - 09:44:35 MDT