# [Wrf-users] interpolating to height above ground

Kevin Matthew Nuss wrf at nusculus.com
Thu Nov 25 11:41:06 MST 2010

```Hi,

I wanted to expand on what Hannes contributed about converting geopotential
height to actual height so that newcomers do not get the wrong impression:

PH and PHB are staggered in the Z direction, meaning that they are at the
tops and bottoms of grid cells. That is fine for the heights of vertical
winds, but for horizontal winds, other prognostic variables, and most
diagnostic variables, the center of the cell should be used. You can average
the top and bottom to get the center. For the cell at vertical level 'k,'
height above sea level is:

*(((PH(k)+PH(k+1)) / 2) + ((PHB(k)+(PHB(k+1)) / 2) / 9.81**
*
Call me lazy if you like (everyone else does), but WRF already makes part of
that calculation and puts it in an unstaggered variable for the geopotential
height at the cell center. That variable is PHP, so height above sea level
for middle of cell(j,i) at level 'k' is PHP(k,j,i) / 9.81. In the subroutine
calc_php, it uses this code:

*php(i,k,j) = 0.5*(phb(i,k,j)+phb(i,k+1,j)+ph(i,k,j)+ph(i,k+1,j))*

But by default, WRF does not output PHP, so in Registry.EM, you would have
to change the line:

*state    real   php            ikj     dyn_em      1         -
r     "php"  "geopotential"             "m2 s-2"*

to

*state    real   php            ikj     dyn_em      1         -      rh
"php"  "geopotential"             "m2 s-2"*

But don't forget to divide by 9.81. And if you hadn't noticed, WRF
internally holds variables with a different index order than it outputs
them. Hope that helps whichever folks need to know such things (I happen to

Kevin

On Mon, Nov 22, 2010 at 11:42 PM, Keller Johannes <johannes.keller at psi.ch>wrote:

> Hi Sam,
>
> I use the staggered geopotential in the WRF history file wrfout....
> Height in m asl is (PH+PHB) / 9.81. Subtract terrain height HGT to get
> height in m agl.
>
> Regards
>
> Hannes
>
>
> On Nov 22, 2010, at 12:20 PM, Sam Hawkins wrote:
>
> > Dear WRF users,
> >
> > I want to interpolate WRF output from eta levels to heights above the
> > model terrain height.  I need the code to be relatively fast, and
> > ideally write to netcdf files. My eta levels are quite closely spaced,
> > so I could probably get away with linear interpolation between levels.
> >
> > Does anyone know whether there is any existing tool which will do this
> > (it seems GEMpak might have this functionality), or (b) are there any
> > tools, such as the netcdf operators or climate data operators which
> > might be adaptable to do this.
> >
> > Sam.
> >
> > --
> > The University of Edinburgh is a charitable body, registered in
> > Scotland, with registration number SC005336.
> >
> > _______________________________________________
> > Wrf-users mailing list
> > Wrf-users at ucar.edu
> > http://mailman.ucar.edu/mailman/listinfo/wrf-users
>
>
> ---------------------------------------------------------------------
> Dr.Johannes Keller
> Paul Scherrer Institut (PSI)
> Laboratory of Atmospheric Chemistry (LAC)
> Building OFLA / 012
> CH-5232 Villigen PSI, Switzerland
> Phone: +41 56 310 20 65,  Fax: +41 56 310 45 25
> e-mail: johannes.keller(at)psi.ch
> http://www.psi.ch/
> http://lac.web.psi.ch
> ---------------------------------------------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20101125/a656be34/attachment.html
```