Metview's documentation is now on readthedocs!

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Metview's Python interface provides access to all of Metview's Macro language functions, with automatic translations between data types. Here's an example that shows how to retrieve model and observation data and compute their difference, and the weighted mean value of that difference, both in Macro and in Python.

MacroPython
# Metview Macro

t2m_fc48 = retrieve(
    type    : "fc",
    levtype : "sfc",
    param   : "2t",
    date    : -5,
    step    : 48,
    grid    : "o1280")

synop = retrieve(
    type   : "ob",
    repres : "bu",
    date   : -3)

synop_t2m = obsfilter(
    output    : "geopoints",
    parameter : 012004,
    data      : synop)

diff = t2m_fc48 - synop_t2m
print(integrate(diff))
import metview as mv

t2m_fc48 = mv.retrieve(
    type    = "fc",
    levtype = "sfc",
    param   = "2t",
    date    = -5,
    step    = 48,
    grid    = "o1280")

synop = mv.retrieve(
    type   = "ob",
    repres = "bu",
    date   = -3)

synop_t2m = mv.obsfilter(
    output    = "geopoints",
    parameter = "012004",
    data      = synop)

diff = t2m_fc48 - synop_t2m
print(mv.integrate(diff))
  • No labels