Image Added
Image Removed
# Metview Macro
# **************************** LICENSE START ***********************************
#
# Copyright 2015 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: contour
# Title: Grid Values and Contour Levels
# Description: Demonstrates how to show the field grid values and define a
# list of contour levels.
# See also:
# https://software.ecmwf.int/magics/Contour+examples+contour3
# ------------------------------------------------------------------
# read the input grib file
my_data = read("t850.grb")
# set up the geographical view
my_view = geoview(map_area_definition : "CORNERS",
map_projection : "CYLINDRICAL",
area : [25.00,-20.00,65.00,50.00])
# set up the coastlines
my_coast = mcoast(map_coastline_land_shade_colour : "CREAM",
map_grid_colour : "TAN",
map_grid : "ON",
map_coastline_colour : "TAN",
map_coastline_land_shade : "ON")
# set up the contour so that grid values are shown
my_contour = mcont(contour_grid_value_plot : "ON",
contour_level_selection_type : "LEVEL_LIST",
contour_level_list : [-20, -10, -5, -2.5, -1, -0.5, 0, 0.5, 1, 2.5, 5, 10, 20],
contour_grid_value_height : 0.30,
contour_grid_value_plot_type : "BOTH",
contour_grid_value_marker_height : 0.20,
contour_line_colour : "GREY",
contour_highlight : "OFF",
contour_line_thickness : 2,
contour_label : "OFF",
contour_grid_value_lon_frequency : 10,
contour_grid_value_lat_frequency : 10,
legend : "OFF")
# set-up the title
my_title = mtext(text_font_size : 0.70,
text_lines : ["Display the grid values and user-defined list of contour levels:",
"[-20, -10, -5, -2.5, -1, -0.5, 0, 0.5, 1, 2.5, 5, 10, 20]",
""],
text_justification : "LEFT",
text_colour : "CHARCOAL")
# 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") then setoutput(to_psfile)
else if (mode = "batch") then setoutput(to_psfile)
else if (mode = "visualise") then print('screen')
else fail("Only execute, batch and visualise allowed")
end if
# plot the data onto the map
plot(my_view,my_data,my_contour,my_coast,my_title)