[ncl-talk] interpolating pressure levels to height levels

Dennis Shea shea at ucar.edu
Sat Feb 17 10:45:57 MST 2018


Looking at a dump of the 'temp.nc'  file, I see that the source file is a
"Monthly Mean of Air temperature" file from NOAA's ESRL/PSD archive.


http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.derived.htm

====
I suggest downloading the 'hgt.mon.mean.nc" and creating a file analogous
to "temp.nc". Then ..

==== untested ======

   fh    = addfile("hgt.nc" , "r")
   ft     = addfile("temp.nc","r")
   hgt  = fh->hgt                      ; (time,level,lat,lon)
   tmp = ft->air                        ;            "

   dimh = dimsizes(hgt)
   dimt  = dimsizes(tmp)
   if (.not.all(dimh.eq.dimt)) then
       print("variable size mismatch")
       print(dimh)
       print(dimt)
       exit
   end if

   linlog = 0      ; user choice
   hlev   = (/ 500, 1500, 9000 /)   ; desired interpolation levels
   lev_dim = 1                           ; (time,level,lat,lon) => dim
number (0,1,2,3)
   thgt      = int2p_n_Wrap(hgt,tmp, hlev, linlog, lev_dim)
   printVarSummary(thgt)

=================
https://www.ncl.ucar.edu/Document/Functions/Built-in/int2p_n.shtml

================
There are many examples for plotting this type of array.

Good Luck


On Fri, Feb 16, 2018 at 10:43 PM, dave montgomery <montgomery_dave at yahoo.com
> wrote:

> Dear Ncl-talk,
> Is there a way to interpolate or convert as well as to plot a 4D
> (time,level,lat,lon) variable that is already on pressure levels (hPa) to
> height levels (m)? In other words, my goal is to plot the data in height
> levels (m) rather than in hPa. I am aware of the "gsn_csm_pres_hgt_vector"
> function for plotting, however, it only plots pressure levels on the Y-axis
> left side which it uses as the main axis for its plot and not the Y-axis
> right side. I even came upon an example from NCL archive (
> http://www.hao.ucar.edu/modeling/tgcm/NCL/Graphics/Scripts/zplat_6.ncl)
> which I used but to no avail. I got error messages: fatal:Undefined
> identifier: (halfzp) is undefined, can't continue; fatal:["Execute.c":8640]:Execute:
> Error occurred at or near line 16 in file zplat.ncl. I know I don't have
> the "halfzp" identifier. I thought it's one of NCL resources. I have
> attached my script and the ".nc" file for your perusal.
> Any assistance on the best way to go would be greatly appreciated.
> Many thanks.
> Dave
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180217/5665d535/attachment.html>


More information about the ncl-talk mailing list