#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 ************************************
# set up the shaded coastlines
land_sea_shade = mcoast(
map_coastline_land_shade : "on",
map_coastline_land_shade_colour : "RGB(0.98,0.95,0.82)",
map_coastline_sea_shade : "on",
map_coastline_sea_shade_colour : "RGB(0.85,0.93,1)"
)
# define the geographic view
view = geoview(
map_projection : "polar_stereographic",
map_area_definition : "corners",
area : [-5,-30,10,84], # S,W,N,E
coastlines : land_sea_shade
)
pltLst = nil
# first polyline (closed) - with shading
latPos = [68, 68, 49, 49, 68]
lonPos = [-45,-17, -17, -45, -45]
incr = 1
# define visualiser
vis = mvl_geopolyline(latPos, lonPos, incr)
# define shading and border
graph_area = mgraph(
graph_type: "area",
graph_shade_colour: "orange",
graph_line_colour : "red",
graph_line_thickness : "4",
graph_line_style : 'dash'
)
pltLst = pltLst & [vis, graph_area]
# second polyline (closed) - with shading
latPos = [48, 48, 40, 28, 28, 42, 48]
lonPos = [5, 25, 38, 38, -10, -10, 5]
incr = 1
# define visualiser
vis = mvl_geopolyline(latPos, lonPos, incr)
# define shading and border
graph_area = mgraph(
graph_type: "area",
graph_shade_colour: "lavender",
graph_line_colour : "blue",
graph_line_thickness : "4",
graph_line_style : 'solid'
)
pltLst = pltLst & [vis, graph_area]
# third polyline (open) - outline only
latPos = [21, 21, 5, 5]
lonPos = [20, 45, 45, 20]
incr = 1
# define visualiser
vis = mvl_geopolyline(latPos, lonPos, incr)
# define shading and border
graph_line = mgraph(
graph_type: "curve",
graph_line_colour : "purple",
graph_line_thickness : "4",
graph_line_style : 'dot'
)
pltLst = pltLst & [vis, graph_line]
# define the output plot file
setoutput(pdf_output(output_name : 'geopolyline_on_map'))
# plot the polygons on the map
plot(view, pltLst) |
|
"""
Geopolyline on Map
=========================
"""
import metview as mv
# **************************** 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 ************************************
# set up the shaded coastlines
land_sea_shade = mv.mcoast(
map_coastline_land_shade = "on",
map_coastline_land_shade_colour = "RGB(0.98,0.95,0.82)",
map_coastline_sea_shade = "on",
map_coastline_sea_shade_colour = "RGB(0.85,0.93,1)"
)
# define the geographic view
view = mv.geoview(
map_projection = "polar_stereographic",
map_area_definition = "corners",
area = [-5,-30,10,84], # S,W,N,E
coastlines = land_sea_shade
)
pltLst = []
# first polyline (closed) - with shading
latPos = [68, 68, 49, 49, 68]
lonPos = [-45,-17, -17, -45, -45]
incr = 1
# define visualiser
vis = mv.mvl_geopolyline(latPos, lonPos, incr)
# define shading and border
graph_area = mv.mgraph(
graph_type= "area",
graph_shade_colour= "orange",
graph_line_colour = "red",
graph_line_thickness = "4",
graph_line_style = 'dash'
)
pltLst.extend([vis, graph_area])
# second polyline (closed) - with shading
latPos = [48, 48, 40, 28, 28, 42, 48]
lonPos = [5, 25, 38, 38, -10, -10, 5]
incr = 1
# define visualiser
vis = mv.mvl_geopolyline(latPos, lonPos, incr)
# define shading and border
graph_area = mv.mgraph(
graph_type= "area",
graph_shade_colour= "lavender",
graph_line_colour = "blue",
graph_line_thickness = "4",
graph_line_style = 'solid'
)
pltLst.extend([vis, graph_area])
# third polyline (open) - outline only
latPos = [21, 21, 5, 5]
lonPos = [20, 45, 45, 20]
incr = 1
# define visualiser
vis = mv.mvl_geopolyline(latPos, lonPos, incr)
# define shading and border
graph_line = mv.mgraph(
graph_type= "curve",
graph_line_colour = "purple",
graph_line_thickness = "4",
graph_line_style = 'dot'
)
pltLst.extend([vis, graph_line])
# define the output plot file
mv.setoutput(mv.pdf_output(output_name = 'geopolyline_on_map'))
# plot the polygons on the map
mv.plot(view, pltLst) |
|
|