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,Hovmoeller
# Title: Hovmoeller Area Average
# Description: Demonstrates how to use a Hovmoeller View to
# compute and plot an area average over time from GRIB data
# ----------------------------------------------------------------------
# read the GRIB data from file
t_ts = read("t_ts.grib")
# set up the view to plot the data into
# we will compute the average value along North/South lines over the
# given area. We also supply a custom Time Axis definition in order
# to increase the size of the date labels
time_axis = maxis(
axis_type : "date",
axis_years_label_height : 0.3,
axis_months_label_height : 0.3,
axis_days_label_height : 0.3
)
hovmoeller_view = mhovmoellerview(
type : "area_hovm",
area : [53.4,-58.9,67.2,118.1],
average_direction : "north_south",
time_axis : time_axis
)
# set up the contouring style
shade = mcont(
legend : "on",
contour : "off",
contour_level_count : 8,
contour_label : "off",
contour_shade : "on",
contour_shade_colour_method : "list",
contour_shade_method : "area_fill",
contour_shade_colour_list : ["blue", "sky", "blue_green", "grey", "cream",
"yellowish_orange", "reddish_orange", "red"]
)
# 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 Hovmoeller view with visdefs for styling
plot(hovmoeller_view, t_ts, shade, title)