Description
Metview Macro Library function. Computes geopotential on model levels.
Usage
fieldset mvl_geopotential_on_ml(t:fieldset, q:fieldset, lnsp:fieldset, zs:fieldset)
Parameter t
should be a fieldset of temperature on model levels in ascending numeric order (e.g. 1-137), q
a fieldset of specific humidity on model levels in ascending numeric order, lnsp
a field of log of surface pressure on model level 1, zs
a field of geopotential on model level 1 (available from MARS). All fields must be GRIDDED data - no spherical harmonics, and they must all be on the same grid, with the same number of points. The function assumes that there are no other dimensions contained in the data, e.g. all fields should have the same date and time. The return value is a fieldset of geopotential on model levels.
Example
r = (date: -1, time: 12, levtype: "ml", grid: [1.5,1.5])
t = retrieve(r,levelist: [1,"to",137],param: "t")
q = retrieve(r,levelist: [1,"to",137],param: "q")
zs = retrieve(r,levelist: 1,param: "z")
lnsp = retrieve(r,levelist: 1,param: "lnsp")
z_ml = mvl_geopotential_on_ml(t, q, lnsp, zs)
5 Comments
Timothy Hewson
Maybe this is documented elsewhere, but should be pointed out here also I think:
So if you want to base code on the example code above for older dates you need to replace the "zs = ..." line with something like this:
zs = retrieve(type: "an", date: thedate, time: thetime, step: 0, levtype: "ml", grid: thegrid, levelist: 1, param: "z")
zs is I think only a function of the model grid, the model orography and the model level definitions, and not of atmospheric structure or evolution, hence why it is not archived in forecast fields
The above is what my investigations (and repeated code failures!) in July 2017 have revealed, but happy to be corrected on any of this if necessary!
Milana Vuckovic
Thank you for this observations! This saved me a lot of headache, after some failed requests when hitting the tape and not fdb..
Jonathan Day
Can this function handle input fieldsets with multiple times (i.e. if I want to calculate z for a number of forecast steps in one call to this function)? Or would I need to loop over the forecast steps?
Iain Russell
Hi Jonny, you would need to loop through the steps.
Sandor Kertesz
Please note this page is outdated. For the most recent documentation see: https://metview.readthedocs.io/en/latest/api/functions/mvl_geopotential_on_ml.html