#Metview Macro
# **************************** LICENSE START ***********************************
#
# Copyright 2020 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 ************************************
#
# get data
use_mars = 0 # 0 or 1
if use_mars = 1 then
# get data from MARS
f = retrieve(
levelist : 850,
param : ["u","v"],
date : 20171016,
time : 0,
area : [30,-40,60,30],
grid : [0.5,0.5]
)
else
# read from grib file
f = read("ophelia_wind_850.grib")
end if
# define coastlines
coast = mcoast(
map_coastline_colour : "RGB(0.8353,0.8353,0.8353)",
map_coastline_thickness : 3,
map_coastline_land_shade : "on",
map_coastline_land_shade_colour : "black",
map_coastline_sea_shade : "on",
map_coastline_sea_shade_colour : "RGB(0.27,0.27,0.27)",
map_boundaries : "on",
map_boundaries_colour : "RGB(0.8353,0.8353,0.8353)",
map_boundaries_thickness : 2,
map_label: "off"
)
# define view
view = geoview(
map_projection : "polar_stereographic",
map_area_definition : "corners",
area : [31.28,-21.36,57.2,23.93],
coastlines: coast
)
# define wind plotting
colour_wind = mwind(
wind_thinning_factor : 0,
legend : "on",
wind_advanced_method : "on",
wind_advanced_colour_selection_type : "interval",
wind_advanced_colour_max_value : 55,
wind_advanced_colour_min_value : 0,
wind_advanced_colour_level_interval : 5,
wind_advanced_colour_max_level_colour : "red",
wind_advanced_colour_min_level_colour : "sky",
wind_advanced_colour_direction : "clockwise",
wind_arrow_legend_text : " M/S"
)
# define the output plot file
setoutput(pdf_output(output_name : 'coloured_wind'))
# generate plot
plot(view, f, colour_wind) |
|
"""
Coloured wind plot
"""
# **************************** LICENSE START ***********************************
#
# Copyright 2020 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 ************************************
#
import metview as mv
# get data
use_mars = False
if use_mars:
# get data from MARS
f = mv.retrieve(
levelist=850,
param=["u", "v"],
date=20171016,
time=0,
area=[30, -40, 60, 30],
grid=[0.5, 0.5],
)
else:
# read from grib file
f = mv.read("ophelia_wind_850.grib")
# define coastlines
coast = mv.mcoast(
map_coastline_colour="RGB(0.8353,0.8353,0.8353)",
map_coastline_thickness=3,
map_coastline_land_shade="on",
map_coastline_land_shade_colour="black",
map_coastline_sea_shade="on",
map_coastline_sea_shade_colour="RGB(0.27,0.27,0.27)",
map_boundaries="on",
map_boundaries_colour="RGB(0.8353,0.8353,0.8353)",
map_boundaries_thickness=2,
map_label="off",
)
# define view
view = mv.geoview(
map_projection="polar_stereographic",
map_area_definition="corners",
area=[31.28, -21.36, 57.2, 23.93],
coastlines=coast,
)
# define wind plotting
colour_wind = mv.mwind(
wind_thinning_factor=0,
legend="on",
wind_advanced_method="on",
wind_advanced_colour_selection_type="interval",
wind_advanced_colour_max_value=55,
wind_advanced_colour_min_value=0,
wind_advanced_colour_level_interval=5,
wind_advanced_colour_max_level_colour="red",
wind_advanced_colour_min_level_colour="sky",
wind_advanced_colour_direction="clockwise",
wind_arrow_legend_text=" M/S",
)
# define the output plot file
mv.setoutput(mv.pdf_output(output_name="coloured_wind"))
# generate plot
mv.plot(view, f, colour_wind)
|
|
|