# Re: [ncl-talk] Vertical Interpolation

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 4 Jan 2006 11:27:54 -0700 (MST)

> Happy New Year!

Happy New Year to u also!

> I am trying to interpolate the CCSM and NCEP/NCAR Reanalysis into Sigma
>coordinates.
> I was wondering if there are subroutines can convert the data from Hybird
>to Sigma coordinates and convert from Pressure to Sigma coordinates.

[a] hybrid to sigma

The next release of NCL [a033; hopefully very soon] has a function
called "hyi2hyo". The purpose is to interpolate from data on
one set of hybrid levels to another set of hybrid levels.

http://www.ncl.ucar.edu/Document/Functions/Built-in/hyi2hyo.shtml

Hybrid levels are a combination of pressure levels and sigma levels

p(k) = A(k)*PO + B(k)*PS
^^^^ ^^^^
pressure sigma

Thus, it seems that this function could be used by setting
the A(k) to 0.0.

hyai = f->hyam ; input A(k)
hybi = f->hybm ; input B(k)
xi = f->X ; variable to be interpolated
p0 = f->P0 ; reference pressure (Pa)

fP = addfile ("file containing surface pressure", "r")
psfc = fP->PSFC ; surface pressure (Pa)

hybo = sigma ; *your* B(k) [ sigma levels ]
nsig = dimsizes(hybo)
hyao = new ( nsig, typeof(hybo))
hyao = 0.0 ; set output A(k) to 0.0

xo = hyi2hyo(p0,hyai,hybi,psfc,xi,hyao,hybo,0)
or, better,
xo = hyi2hyo_Wrap(p0,hyai,hybi,psfc,xi,hyao,hybo,0) ; contributed.ncl
printVarSummary(xo)

[b] pressure to sigma

It seems to me that a combination of

http://www.ncl.ucar.edu/Document/Functions/Built-in/pres_sigma.shtml
and
http://www.ncl.ucar.edu/Document/Functions/Built-in/int2p.shtml

Depending upon the shape of psfc

pSigma = pres_sigma (sigma, psfc) ; pSigma(klvl,nlat,mlon)
pSigma = pres_sigma (sigma, psfc) ; pSigma(ntim,klvl,nlat,mlon)
time,pSig, lat, lon)

f = addfile ("reanalysis.." , 'r")
xi = f->X ; (time,plevel,lat,lon)
pi = f->pressure_levels ; [*]

linlog = 0 or 1
x_out = int2p(pi,xi(time|:,lat|:,lon|:,plevel|:), \
pSigma(time|:,lat|:,lon|:,pSig|:), linlog)

good luck
D

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 04 2006 - 11:27:54 MST

This archive was generated by hypermail 2.2.0 : Sat Jan 07 2006 - 13:49:47 MST