Metview's documentation is now on readthedocs!

Download source and data


Geoline on Map Example
# Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2018 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 ************************************

# ---------------------------------------------------------------
# Description: Demonstrates how to plot a line on any map
#              projection using the Macro Library function
#              mvl_geoline.
# ---------------------------------------------------------------



# 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
)

# create a geoline broken into 1-degree segments
line_increment_in_degrees = 1

# coordinates of line end-points  given as lat1,lon1,lat2,lon2
geoline = mvl_geoline(55, -22, 5, 45, line_increment_in_degrees)


# define the plotting attributes for the line
line_visdef = mgraph(
    graph_line_colour    : "red",
    graph_line_thickness : "4",
    graph_line_style     : 'dash'
)


# define the output plot file
setoutput(pdf_output(output_name : 'geoline_on_map'))

# plot the line on the map
plot(view, geoline, line_visdef)
Geoline on Map Example
# Metview Example

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2018 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 ************************************

# ---------------------------------------------------------------
# Description: Demonstrates how to plot a line on any map
#              projection using the Macro Library function
#              mvl_geoline.
# ---------------------------------------------------------------

import metview as mv

# 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
)

# create a geoline broken into 1-degree segments
line_increment_in_degrees = 1

# coordinates of line end-points  given as lat1,lon1,lat2,lon2
geoline = mv.mvl_geoline(55, -22, 5, 45, line_increment_in_degrees)


# define the plotting attributes for the line
line_visdef = mv.mgraph(
    graph_line_colour    = "red",
    graph_line_thickness = "4",
    graph_line_style     = 'dash'
)


# define the output plot file
mv.setoutput(mv.pdf_output(output_name = 'geoline_on_map'))

# plot the line on the map
mv.plot(view, geoline, line_visdef)