Metview's documentation is now on readthedocs!

Description

Metview Macro Library function. Used to plot a circle with a given radius in km onto a non-cylindrical map projection. Internally, the circle is split into a number of segments and the returned result is an Input Visualiser object which can be passed to the plot() command along with an optional Graph Plotting object.

Usage

definition mvl_geocircle(lat : number, lon : number,radius : number, resolution : number)

The first three parameters specify the centre and the radius (in km) of the circle. Parameter resolution defines the number of line segments to use to make up the circle.

Example


# Metview Macro

# **************************** LICENSE START ***********************************
# 
# Copyright 2017 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: mvl,coast
# Title: Geocircle on Map
# Description: Demonstrates how to plot a circle on any map
# projection using the Macro Library function
# mvl_geocircle.
# ---------------------------------------------------------------

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

# define the radius of the circles (in km) 
circle_radius = 200

# the circle will be made up of this many segments
circle_resolution = 80

# define the centres of the circles 
latPos=[58,48,38,28,18,8]
lonPos=[-20,-8,4,16,28,40]

# build the plot the finition of the circles
pltLst=nil
for i=1 to count(latPos) do

    # define the cirle around the specifed coordinates
    iv_circle = mvl_geocircle(latPos[i],lonPos[i],circle_radius,circle_resolution)

    # define the plotting attributes for the circle 
    graph_circle = mgraph
    (
        graph_line_colour    : "red",
        graph_line_thickness : "4",
        graph_line_style     : 'solid'
    )

    # collect the plot definitions into a list
    pltLst=pltLst & [iv_circle,graph_circle]

end for

# define the output media
to_pdf_file = pdf_output
(
    output_name : "plot" # extension is added automatically
)

# check the runmode and decide which media to put the plot to
mode = runmode()
if  mode = "execute" or mode = "batch" then
    setoutput(to_pdf_file)
end if

# plot the circles on the map
plot(view, pltLst)