Metview's documentation is now on readthedocs!

Download source and data


Cross Section Example
# Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2018 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************

# ------------------------------------------------------------------
# Description: Demonstrates how to use a Cross Section View to
#              compute and plot a vertical cross section of GRIB data
# ------------------------------------------------------------------



# read the GRIB data from file
t_fc = read("t_fc24.grib")

# set up the view to plot the data into
cross_section_view = mxsectview(
    bottom_level : 1000.0,
    top_level    : 1,
    line         : [-1.2, -105.6, 61.5, 85.1] #lat,lon,lat,lon
)


# set up the contouring style
shading = mcont(
    legend                         : "on",
    contour                        : "off",
    contour_level_count            : 12,
    contour_label                  : "off",
    contour_shade                  : "on",
    contour_shade_method           : "area_fill",
    contour_shade_max_level_colour : "RGB(0.72,0.059,0.059)",
    contour_shade_min_level_colour : "RGB(0.99,0.98,0.98)"
)

# set up the title, just to make the font bigger
title = mtext(text_font_size : 0.5)

# define the output plot file
setoutput(pdf_output(output_name : 'cross_section_pl_data'))

# plot the data into the Cross Section view with visdefs for styling
plot(cross_section_view, t_fc, shading, title)
Cross Section Example
# Metview Example

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2018 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************

# ------------------------------------------------------------------
# Description: Demonstrates how to use a Cross Section View to
#              compute and plot a vertical cross section of GRIB data
# ------------------------------------------------------------------

import metview as mv

# read the GRIB data from file
t_fc = mv.read("t_fc24.grib")

# set up the view to plot the data into
cross_section_view = mv.mxsectview(
    bottom_level = 1000.0,
    top_level    = 1,
    line         = [-40.1, -105.6, 61.5, 85.1] #lat,lon,lat,lon
)


# set up the contouring style
shading = mv.mcont(
    legend                         = "on",
    contour                        = "off",
    contour_level_count            = 12,
    contour_label                  = "off",
    contour_shade                  = "on",
    contour_shade_method           = "area_fill",
    contour_shade_max_level_colour = "RGB(0.72,0.059,0.059)",
    contour_shade_min_level_colour = "RGB(0.99,0.98,0.98)"
)

# set up the title, just to make the font bigger
title = mv.mtext(text_font_size = 0.5)

# define the output plot file
mv.setoutput(mv.pdf_output(output_name = 'cross_section_pl_data'))

# plot the data into the Cross Section view with visdefs for styling
mv.plot(cross_section_view, t_fc, shading, title)