Metview's documentation is now on readthedocs!

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

For more information, see Migrating from Metview 3 to Metview 4.

The following examples illustrate the differences in how Metview 4 can be used to emulate the Split Contour functionality of Metview 3. The key is to use three contour definitions instead of one.

 

Metview 3 code

# Metview Macro

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

# NOTE: THIS EXAMPLE EXISTS FOR THE COMPARISON OF METVIEW 3 AND METVIEW 4
# FEATURES, AND SHOULD NOT BE USED AS A TEMPLATE FOR METVIEW 4 CODE.

# ---------------------------------------------------------------
# Tags: Contour,Metview3,MARS
# Title: Split Contouring Metview 3
# Description: Demonstrates Metview 3's split contouring facility
# ---------------------------------------------------------------


data = retrieve(param:'t', levelist: 1000, grid: [1.5,1.5], date: -10)

split = pcont
(
    contour_line_plotting: "split"
)



# Define the output media

to_psfile = output
(
    format       : "postscript",
    destination  : "file",
    ncopies      : 1,
    file_name    : "plot.ps"
)


# Check the runmode and decide which media to putput the plot to
    
mode = runmode()
if  mode = "execute" or mode = "batch" then setoutput(to_psfile)
else                                        setoutput(to_screen)
end if


dw = plot_superpage ()
plot (dw, data, split)

Metview 4 code

# Metview Macro

# **************************** LICENSE START ***********************************
#
# Copyright 2015 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: Contour,Metview3,MARS
# Title: Split Contouring Metview 4
# Description: Demonstrates how to emulate Metview 3's split
#              contouring facility using multiple Contouring
#              definitions in Metview 4
# ---------------------------------------------------------------

data = retrieve(param:'t', levelist: 1000, grid: [1.5,1.5], date: -10)

split_below = mcont
(
    contour_line_style      : "dash",
    contour_highlight_style : "dash",
    contour_max_level       : 0,
    contour_level_count     : 5
)

split_above = mcont
(
    contour_line_colour      : "red",
    contour_highlight_colour : "red",
    contour_min_level        : 0,
    contour_level_count      : 5
)

split_on = mcont
(
    contour_line_thickness : 3,
    contour_line_colour    : "black",
    contour_highlight      : "off",
    contour_max_level      : 0,
    contour_min_level      : 0
)

# Define the output media

to_psfile = ps_output
(
    output_name : "plot" # extension is added automatically
)


# Check the runmode and decide which media to putput the plot to
    
mode = runmode()
if  mode = "execute" or mode = "batch" then
    setoutput(to_psfile)
end if


plot (data, split_below, split_above, split_on)

  • No labels