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

Version 1 Next »

# Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2016 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 ************************************

# ------------------------------------------------------------------
# Tags: GRIB,Cross Section
# Title: Cross Section
# 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]
)


# 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 media
to_psfile = ps_output
(
    output_name : "plot" # extension is added automatically
)


# Check the runmode and decide which media to putput the plot to
mode = runmode()
if  mode = "execute" or mode = "batch" then
    setoutput(to_psfile)
end if


# plot the data into the Cross Section view with visdefs for styling
plot(cross_section_view, t_fc, shading, title)
  • No labels