# **************************** LICENSE START ***********************************
#
# Copyright 2019 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
# read grib file - contains only one timestep and level
f = mv.read("advection_850.grib")
# filter u and v wind components
u = mv.read(data = f, param = "u")
v = mv.read(data = f, param = "v")
# define coastlines
coast = mv.mcoast(
map_coastline_land_shade = "on",
map_coastline_land_shade_colour = "RGB(0.6,0.6,0.6)",
map_coastline_sea_shade = "on",
map_coastline_sea_shade_colour = "RGB(0.9275,0.9275,0.9313)",
map_coastline_colour = "RGB(0.5,0.5,0.5)",
map_coastline_resolution = "medium"
)
# define the view
view = mv.geoview(
coastlines = coast,
map_area_definition = "corners",
area = [38,-24,60,10]
)
# define wind plotting
wdef = mv.mwind(
wind_field_type = "streamlines",
wind_streamline_min_density = 3,
wind_streamline_colour = "ecmwf_blue",
wind_streamline_head_ratio = 0.4
)
# define the output plot file
mv.setoutput(mv.pdf_output(output_name = 'streamline'))
# generate the plot
mv.plot(view, mv.merge(u,v), wdef)
|