Metview's documentation is now on readthedocs!

Download source and data


FLEXTRA Forward Trajectories Example
#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 ************************************
#

# read file containing the results of a FLEXTRA
# forward simulation with 5 trajectories started at the
# same location and height at different times
# (i.e. a FLEXTRA simulation with mode="normal")
f = read("flextra_res_normal.txt")

# define visualiser
vis = flextra_visualiser(
    flextra_data	:	f
)

# define coastlines
coast = mcoast(
    map_coastline_resolution        : "medium",
    map_coastline_land_shade        : "on",
    map_coastline_land_shade_colour : "RGB(0.5569,0.5569,0.5569)",
    map_coastline_sea_shade         : "on",
    map_coastline_sea_shade_colour  : "RGB(0.8,0.8,0.8)",
    map_boundaries                  : "on",
    map_boundaries_colour           : "burgundy"
    )

# define view
view = geoview(
    map_projection      : "polar_stereographic",
    map_area_definition : "corners",
    area                : [31.81, -20.24, 52.57, 63.93],
    coastlines	:	coast
    )

# define symbol plotting
sym = msymb(
		legend	:	"on",
		symbol_type	:	"marker",
		symbol_table_mode	:	"advanced",
		symbol_connect_line	:	"on",
		symbol_advanced_table_selection_type	:	"interval",
		symbol_advanced_table_min_value	:	1,
		symbol_advanced_table_max_value	:	6,
		symbol_advanced_table_interval	:	1,
		symbol_advanced_table_max_level_colour	:	"blue",
		symbol_advanced_table_min_level_colour	:	"magenta",
		symbol_advanced_table_colour_direction	:	"clockwise",
		symbol_advanced_table_marker_list	:	[15,16,17,18,19],
		symbol_advanced_table_height_list	:	0.5
		)

# define title
title = mtext(text_font_size: 0.6)

# define legend
legend = mlegend(legend_display_type: "disjoint",
            legend_text_font_size: 0.35)

# define output
setoutput(pdf_output(output_name : 'flextra_forward'))

# generate plot
plot(view, legend, vis, sym, title)
FLEXTRA Forward Trajectories Example
"""
FLEXTRA Forward Trajectories
===============================
"""

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

# read file containing the results of a FLEXTRA
# forward simulation with 5 trajectories started at the
# same location and height at different times
# (i.e. a FLEXTRA simulation with mode="normal")
f = mv.read("flextra_res_normal.txt")

# define visualiser
vis = mv.flextra_visualiser(flextra_data=f)

# define coastlines
coast = mv.mcoast(
    map_coastline_resolution="medium",
    map_coastline_land_shade="on",
    map_coastline_land_shade_colour="RGB(0.5569,0.5569,0.5569)",
    map_coastline_sea_shade="on",
    map_coastline_sea_shade_colour="RGB(0.8,0.8,0.8)",
    map_boundaries="on",
    map_boundaries_colour="burgundy",
)

# define view
view = mv.geoview(
    map_projection="polar_stereographic",
    map_area_definition="corners",
    area=[31.81, -20.24, 52.57, 63.93],
    coastlines=coast,
)

# define symbol plotting
sym = mv.msymb(
    legend="on",
    symbol_type="marker",
    symbol_table_mode="advanced",
    symbol_connect_line="on",
    symbol_advanced_table_selection_type="interval",
    symbol_advanced_table_min_value=1,
    symbol_advanced_table_max_value=6,
    symbol_advanced_table_interval=1,
    symbol_advanced_table_max_level_colour="blue",
    symbol_advanced_table_min_level_colour="magenta",
    symbol_advanced_table_colour_direction="clockwise",
    symbol_advanced_table_marker_list=[15, 16, 17, 18, 19],
    symbol_advanced_table_height_list=0.5,
)

# define title
title = mv.mtext(text_font_size=0.6)

# define legend
legend = mv.mlegend(legend_display_type="disjoint", legend_text_font_size=0.35)

# define output
mv.setoutput(mv.pdf_output(output_name="flextra_forward"))

# generate plot
mv.plot(view, legend, vis, sym, title)