Project

General

Profile

converting vertical coordinates in WRF output

Added by david moreno over 3 years ago

Hi all,

I have WRF output in native model grid (eta levels) and the variables pressure, geopotential height (among other obviously).

I added a new variable with cdo, height (z), where z=geopotential/grav.

Is there a way to convert the grid vertical coordinate from eta levels to height levels, something like ml2hl? i tried this but I got an error that no sigma coordinates were found...

Any help is greatly appreciated!

Cheers


Replies (10)

RE: converting vertical coordinates in WRF output - Added by Ralf Mueller over 3 years ago

hi david!

Usually the vertical coordinate is highly model specific - there is a zoo of such coordinate systems out there and I have no further information about how WRF is handling this, i.e. what really is a model level in that context. An example file as an upload would help at least wrt. what can be done technically with the WRF output.

In case you know a specific formular, you can first create a new data variable, that holds the values of the original coordinate transformed into another system (which basically is the same as a unit conversion). The data values that use this new (or the old coordinate) stay the same of course.

In a next step you could generate a new (possibly 3d) field of vertical coordinate values, that you would like to interpolate to. maybe something more regular depending of the new unit. After this you can use the operator intlevel3d to interpolate from one 3d vertical coordinate to a new one.

hth
ralf

RE: converting vertical coordinates in WRF output - Added by Ralf Mueller over 3 years ago

I myself would try to get more information from the WRF guys - they should now best how to work with its vertical axes

RE: converting vertical coordinates in WRF output - Added by david moreno over 3 years ago

Hi Ralf, thanks so much for your reply.

Actually, WRF output vertical coordinates (eta levels) are just indexes. The levels just distribute the model levels between the model top and the surface. Since pressure will vary at the surface, both horizontally and temporally, then the level value of 1 will be the surface level (versus the model top, with the sigma value of 0, which will usually be a fixed pressure). The first model level above the surface should have a pressure of (model top) + (sigma)*(surface pressure - model top). Thus, if you have a model top of 50 mb, a surface pressure of 1000 mb, and a first sigma value above the surface of 0.995, then the pressure of that sigma level should be 50 + 0.995 * (1000 - 50) = 995.25 mb.

WRF outputs the pressure, height, geopotential and other possible "candidates" for a "real" vertical axis as 3D fields, since all of them vary in time and space. Ah, and the whole grid is 3D-staggered for some vars, which further complicate things... However, I could refer the staggered vars to unstaggered coordinates, the difference would be very small for my case.

I attach to this post an example of a WRF output for a single time step. if somehow you manage to figure out how I could transform the vertical coordinate to pressure, height or geopotential please let me know.

Thanks again.

Dave

RE: converting vertical coordinates in WRF output - Added by Ralf Mueller over 3 years ago

So WRF is a hydrostatic model? I thought it would be used for NWP

You seem to have selected P and PH on your own (as shown in the history). Maybe there are other variables in the original wrf file related to the vertical coordinate.

RE: converting vertical coordinates in WRF output - Added by Ralf Mueller over 3 years ago

current WRF docu sais

The WRF-ARW core is based on an Eulerian solver for the fully compressible nonhydrostatic equations, cast in flux (conservative) form, using a mass (hydrostatic pressure) vertical coordinate.

So hydrostatic pressure is used for vertical coordinate

RE: converting vertical coordinates in WRF output - Added by david moreno over 3 years ago

Yes, I cropped the wrfout (the original one is huge) just to show you the vertical structure.

I think that only these vars are related to the vertical coordinates in the original wrfout:

float ZNU(Time, bottom_top) ;
ZNU:description = "eta values on half (mass) levels" ;
ZNU:units = "" ;

float ZNW ;

ZNW:description = "eta values on full (w) levels" ;
ZNW:units = "" ;

RE: converting vertical coordinates in WRF output - Added by Ralf Mueller over 3 years ago

WRF officially mentions NCL for post-processing and NCL comes with a lot WRF-specific funtionality (https://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_interp_3d_z.shtml)

RE: converting vertical coordinates in WRF output - Added by david moreno over 3 years ago

Yes, but I'm not a big fan of NCL, that's why i was wondering if CDO could do this also

RE: converting vertical coordinates in WRF output - Added by Ralf Mueller over 3 years ago

Not my favourite tool ether. I don't want to push you away from CDO, but if the officials say "Look this is how it is supposed to be done!" why not stick to this?

complete list of methods: https://www.ncl.ucar.edu/Document/Functions/wrf.shtml

I'm sure, we could make it work somehow, but for reference I'd recommend comparing it with the results from NCL anyway. If used wisely, NCL can be pretty powerful. The thing is that IMO it is

  • not supposed to be used for big applications, because it hardly supports complex code structures
  • its many methods are designed for a special purposes within a special context. For that context, they are very powerful, but re-using them in other contexts is not part of the plan. CDO in contrast is a toolbox, where you are meant to combine existing operators with each other in order to create your own analysis

But NCL has a huge plotting feature set and this demands a completely different approach than pure data analysis like in CDO. I personally don't see them as competitors but more as complements of one another. Due to its close relation to US-NWP institutions, it offers very specific stuff like all the WRF functions. CDO instead is more general on the one hand, since it can work with any CF or GRIB compliant data, but provides special solutions for ECHAM, MPIOM and ICON, i.e. models developed in Germany.

Don't make your life harder - 2020 was bad enough ;-)

RE: converting vertical coordinates in WRF output - Added by david moreno over 3 years ago

Yes, i totally agree :)

Besides not liking NCL, I know very little about it since I mainly use NC tools to manipulate NC files, not to plot stuff (I prefer py or matlab to do that).

In NCL I've managed to interpolate WRF vertical grid to pressure or height coordinates (wrf_interp.ncl), but I am struggling to figure out how to write the converted fields into a netcdf file...

    (1-10/10)