Versions Compared

Key

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

...

Create a new Macro icon and rename it outputs. Write a small macro to read the file z500.grib and plot it. If the macro is run in batch mode, the plot should be saved as a PDF file somewhere into /tmp; otherwise, plot it to the screena PNG file.

  1. Run the code in the Macro Editor and see what happens if your execute the macro.
  2. Go on the command line and change to the directory where the macro is located. Execute the macro from the command line outside Metview.

...

This function is normally used within loops to generate output of each iteration on a separate page (or file). It is the only way to use different views on different pages - this is the main purpose of it.

To use newpage() you need first to define a plot_superpage() as shown in the example below.

Code Block
languagepy
titleMultiple pages
...
 
dw = plot_superpage(
    pages : [plot_page(),plot_page()]] #  use default page
)

plot(dw[1], ...)
newpage(dw)
 
...
plot(dw[2], ...)

Here we create two a default sized pages page with plot_page(), which attach attaches to the super page. Than we assign each plot command to a page.

...

Take the macro from the previous task and add a page where you visualise the same field but over Europe only.modify it to produce a 2-page output: the first page should be on a default Geographic View, the second should be over Europe only. Only plot the first field in the data. The result should be 2 PNG files or a 2-page PDF, depending on how you run the macro.

Further processing outside Metview

...

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

...

  • We provided you with some example WMS icons. Try out the four WMS icons in the directory by visualising them.
  • Edit the icons to see the catalogues of layers available.
  • Drop the icon into a macro editor to explore how a WMS retrieval looks like.

...