Versions Compared

Key

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

Table of Contents

Scroll pdf ignore
Panel
titleDownload
Expand
titleClick here for files to download...
Excerpt Include
A Quick Tour of Metview
A Quick Tour of Metview
nopaneltrue

Attachments
uploadfalse
oldfalse
patterns*.tar.gz,*.grib,*.grb
sortByname

...

All graphical output formats are generated through ECMWF's graphics library Magics. This means that all graphical capabilities in Metview depend on what Magics offers. Detailed descriptions of the output formats and their settings can be found in the Magics reference documentation.

The table below gives you a list of all the formats that Magics/Metview support and how you can use them.

FormatparameterHow to visualiseWhat to use for
Qt/screen Metview display windowInteractive usage within Metview
PostScriptps/epsokular, ghostscript/gvPrinting, publications
PDFpdfokular, acroreadWeb, archiving, printing
PNGpngweb browsers, display, xvWeb, presentations -> animations
SVGsvgweb browsers, vector graphics editor (e.g. Inkscape)Web HTML5, for further editing in drawing programs
KML/KMZkmlGoogle Earth, Google Maps, OpenLayersInteractive (non-scientific) publications

The KML output format

KML is a very special output format. It has no notion of output size since it is displayed on the globe. KMZ is the compressed version of the KML files and is written by default. You can write out the uncompressed KML if you want to debug the output.

...

The following piece of code shows the simplest way to save your plot as a PostScript PDF file instead of creating an interactive Display Window.

Code Block
languagepy
# set up the output format

 ps pdf = pspdf_output(
      output_name : "my_plot"
)
setoutput(pspdf)


data = read("z500.grib")
plot(data)  #  the plot will be sent to the PostScriptPDF file

Try it!

The pspdf_output() function defines how a PostScript PDF file should be generated. More options are available to further customise it. The setoutput() function selects this output format. So our code can contain many output format definitions and then select just one (or more) with the setoutput() function at run-time (see later).

The following code example shows how to set multiple output formats at the same time and also set various parameters for the different output formats. Note that in most cases the default values are sufficient. A list of all options can found in the Magics documentation for each format at: PostScriptSVG, PNG and KML.

Code Block
languagepy
titleSeeting multiple outputs in Metview Macro
linenumberstrue
#
# Setting common output options for multiple formats
#
output_common = ( 
      output_name            : "/tmp/myOutputTest",   # specify relative or full path
      output_title           : "Map of Z500",        # title used by a viewer
      output_debug           : "ON",                 # print extra information
)

ps = ps_output(
      output_filelistcommon,
        : "ON",output_ps_scale        : 0.9,    # scale content to 90%, #for save list of files generatedsome printers
      output_filelist_name   ps_colour_model : "/tmp/filelist.txtCMYK"   # whereset tocolour savemodel theto listCYMK
)

pspng = pspng_output(
      output_common,
      output_ps_scalewidth           : 0.9,1000,            #   scale content to# 90%,set forwidth somein printerspixels
      output_pscairo_colourtransparent_modelbackground : "CMYKON"  # setto colourget modeltransparent to CYMKPNGs
)

pngsvg = pngsvg_output(
      output_common,
      output_width           : 1000,                 # set width in pixels
      output_cairosvg_transparentfix_backgroundsize : "ON",   # tothis getfixes transparent PNGs
)

svg = svg_output(the size to 'output_width'
      output_common,
svg_meta     : output_width"Metview map       : 1000,of Z500",
      output_svg_desc     : "This file was generated for #the set width in pixelsTraining course"
)

kml = kml_output(
      output_svg_fix_size : "ON",common,
   # this fixes the size to 'output_width' kml_description : "This file was generated for the Training course",
      output_svg_metakml_author      : "Metview map of Z500Stephan Siemen",
      outputkml_svg_desclink     : "This file was generated for the Training course"
)

kml = kml_output(
: "http://www.ecmwf.int",
      kml_latitude    :  output_common30,
     # kml_descriptionlatitude :where "ThisGoogle fileEarth wascentres generatedthe forview
 the Training course",
      kml_author longitude     : "Stephan Siemen"120,
    # longitude kml_linkwhere Google Earth centres     : "http://www.ecmwf.int",the view
      kml_latitude  coastlines  : 30,     # latitude where Google Earth centres the view
      kml_longitude   : 120,    # longitude where Google Earth centres the view
      kml_coastlines  : "ON"    # normally 
)

output_drivers = [ps, png, svg, kml]

setoutput(output_drivers)

data = read("z500.grib")

plot(data)"OFF"
)

output_drivers = [ps, png, svg, kml]

setoutput(output_drivers)

data = read("z500.grib")

plot(data)

Setting output dependent on Setting output dependent on runmode

Depending on how you run your Macros you might want to specify various output formats. For example, you might sometimes open your output in the display window, while you might like to save it to a PNG file when you run your Macro in batch. The way to code run mode dependent outcomes is by using the function runmode(). It returns a string with the run mode:

...

Of course you can do further processing of plots outside Metview. The page Generating animated GIFs from Metview plots gives you some helpful advice if you want to build animations.

Metview/Magics also supports special tags in SVG for the Inkscape graphical editor. This open source editor is great for when you need to further annotate your maps.

Image RemovedImage Added

If you have extra time

If you have time, you might want to try opening your SVG file from the first exercise above in inkscape and alter it and save it to a PNG.

Using Web Map Services (WMS)

Metview provides a module to request maps from a Web Map Services (WMS). The WMS standard is defined by the Open Geospatial Consortium (OGC), which is very popular in the GIS community. The WMS module can be used to query an OGC-compliant WMS server, retrieve maps from it and overlay them with other data. The WMS icon is a great way to integrate web services within Metview. 

We have a separate tutorial which shows in more detail how you can use maps served by web map services within Metview.

Tasks

...

.