Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Merge several fieldsets. The same as the operator &. The output is a fieldset with as many fields as the total number of fields in all merged fieldsets. Merging with the value nil does nothing, and is used to initialise when building a fieldset from nothing.


Anchor
ml_to_hl
ml_to_hl

fieldset ml_to_hl(mfld: fieldset, z: fieldset, zs: fieldset, hlist: list, reflev: string, method: string)

Interpolates a fieldset on model levels (i.e. on hybrid or eta levels used by the IFS) onto height levels (in m) above sea or ground levelAt gridpoints where interpolation is not possible missing value is returned. This function has the following positional arguments:

  1. mfld: the fieldset to be interpolated
  2. z: the geopotential fieldset on model levels  (it must contain the same levels as mfld but the order of the levels can be different)
  3. zs: the surface geopotential field (if the reflev argument is set to "sea" it should be set to nil).
  4. hlist: the list of target height levels (they can came in any given order)
  5. reflev: specifies the reference level for the target heights. The possible values are "sea" and "ground"
  6. method: specifies the interpolation method. The possible values are "linear" and "log".

Please note that geopotential is not archived operationally on model levels in MARS at ECMWF.  To compute geopotential on model levels use Metview's mvl_geopotential_on_ml() function. The following example shows how to use function mv_to_hl() together with mvl_geopotential_on_ml() :

Code Block
languagepy
# retrieve the data on model levels - surface geopotential (zs) is only available in the first forecast step!

common_retrieve_params = ( type : "fc", levtype : "ml", step : 12, grid : [1.5,1.5] )
t = retrieve param : "t", levelist : [1, 'to', 137], common_retrieve_params)
q = retrieve param : "q", levelist : [1, 'to', 137], common_retrieve_params)
lnsp = retrieve( param : "lnsp", levelist : 1, common_retrieve_params)
zs = retrieve( param : "z", levelist : 1, type : "fc", levtype : "ml", step : 0, grid : [1.5,1.5])

# compute geopotential on model levels
z = mvl_geopotential_on_ml(t, q, lnsp, zs)


# interpolate the t field onto a list of height levels above sea level
hlevs = [1000, 2000, 3000, 4000, 5000]
th = mv_to_hl (t, z, nil, hlevs, "sea", "linear")

...