Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Info
titleDownload source and data

split_contour.tar.gz


Tabs Container
directionhorizontal


Tabs Page
titleMacro


Code Block
languagepy
titleSplit Contouring 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 one way to emulate Metview 3's split
#              contouring facility using multiple Contouring
#              definitions in later Metview versions
# ---------------------------------------------------------------



use_mars = 1
if use_mars then
    # Retrieve data from MARS
    data = retrieve(
        param    :'t',
        levelist : 1000,
        grid     : [1.5,1.5],
        date     : -10)
else
    data = read('t1000.grib')
end if
    

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 plot file
setoutput(pdf_output(output_name : 'split_contour'))

# plot the data onto the map
plot (data, split_below, split_above, split_on)


Tabs Page
titlePython


Code Block
languagepy
titleSplit Contouring 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 one way to emulate Metview 3's split
#              contouring facility using multiple Contouring
#              definitions in later Metview versions
# ---------------------------------------------------------------

import metview as mv

use_mars = 1
if use_mars:
    # Retrieve data from MARS
    data = mv.retrieve(
        param    ='t', 
        levelist = 1000, 
        grid     = [1.5,1.5],
        date     = -10)
else:
    data = mv.read('t1000.grib')



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

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

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


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

# plot the data onto the map
mv.plot(data, split_below, split_above, split_on)