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: Temperature Below 0C
# Description: Demonstrates how to define a contour level list so that only
# field values in a certain range are coloured.
# See also:
# https://software.ecmwf.int/magics/Contour+examples+contour10
# ------------------------------------------------------------------
# read the input grib file
my_data = read("2m_temperature.grib")
# set up the geographical area
my_view = geoview(map_area_definition : "CORNERS",
map_projection : "CYLINDRICAL",
area : [35,-15,70,35])
# set up the background coastlines
my_background = mcoast(map_label : "ON",
map_grid_line_style : "DASH",
map_grid_colour : "GREY",
map_coastline_colour : "BLACK",
map_coastline_land_shade : "OFF")
# set up the contour so that only one level is coloured
my_contour = mcont(contour_level_selection_type : "LEVEL_LIST",
contour_level_list : [-70.00,0.00],
contour_label : "OFF",
legend : "ON",
contour : "OFF",
contour_shade : "ON",
contour_shade_colour_method : "LIST",
contour_shade_method : "AREA_FILL",
contour_shade_colour_direction : "ANTI_CLOCKWISE",
contour_shade_colour_list : ["rgba(0.498,0.8,0.8,0.6)"])
# set-up the land colour
my_foreground = mcoast(map_coastline_land_shade : "ON",
map_coastline_land_shade_colour : "CREAM")
# set-up the title
my_title = mtext(text_font_size : 0.5,
text_lines : ["<font size='0.7'>Temperature below 0C</font>",
"<magics_title/>",
""],
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_background,my_data,my_contour,my_foreground,my_title)