Versions Compared


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



This exercise shows how to retrieve GRIB data from MARS, examine its structure, compute the differences between fields and visualise the data in various ways.

Retrieving the analysis data

To perform a MARS retrieval in Metview, right-click on an empty area of the Metview desktop and select Create New Icon from the context menu. Select Mars Retrieval and hit Return or click OK. This will create a copy of the icon for you to customise. Rename the new icon to temperature_analysis by clicking on its name. Edit your icon (right-click & edit, see Figure 2) and set the following parameters:



Note: sets the desired meteorological parameter to Temperature
Date-3Note: sets the analysis base time to 3 days ago
Grid1/1Note: interpolates the result onto a 1.0-degree grid


To save these settings, click the Save button at the bottom-left of the icon editor (or click Ok to save and close the editor).

Inspecting the analysis data

Perform the data retrieval by choosing execute from the icon's context menu. The icon name should turn orange whilst the retrieval takes place, then green to indicate success (if the name turns red, then the retrieval failed and you should look in the output log, available from the Log entry in the context menu). The data is now cached locally. To see what was retrieved, right-click examine the icon. This brings up Metview's GRIB Examiner tool (Figure 3). Here we can see that we retrieved six vertical levels of data; this is as expected if we look at the Levelist parameter in the icon editor.

The GRIB Examiner allows in-depth examination of GRIB files with many ways to customise the information. We will not cover these facilities in this introduction.

Now visualise the data, again using the icon's context menu. You will see a map plot with the default contouring style in the Display Window (Figure 4). The zoom controls in the toolbar give control over the area selection.

To plot the data with shaded colours, create another new icon - this time select the Contouring icon. Rename it shade and edit it, providing these parameters:

Contour ShadeOn 
Contour Shade MethodArea Fill 
Contour Shade Max Level ColourRedNote: to select a colour, click the small triangle next to the parameter name to reveal the colour selection dialogue
Contour Shade Min Level ColourBlue 
Contour Shade Colour DirectionClockwise 

Save the icon settings (Save) and drop this into the Display Window (re-visualise the data if you have closed the Display Window). The result should resemble Figure 5. Metview's Contouring icon provides much flexibility in choosing how to display gridded fields; this tutorial uses only simple colour schemes.

The fields can be visualised using different views. These can be defined by a set of icons such as Geographical View and Cross Section View. In the solutions folder are 2 pre-prepared view icons for you to try. Visualise the polar_stereo_europe icon and drop your temperature_analysis icon into the resulting Display Window. If you edit this view icon, you will see how to define a geographical view. Now close the Display Window and visualise your data in the same way with the the cross_section_example view. This icon defines a geographical line along which a cross section of the data is computed (remember that the data consists of a number of vertical levels). You can also drop your shade icon into the plot (Figure 6).

The Display Window provides a number of facilities for further inspection of the data (e.g. magnifier, point values, histogram) , not covered here.

Scroll Pagebreak

Retrieving the forecast data

In your original Metview directory create a copy of your temperature_analysis icon (right-click, Duplicate) and rename the copy to temperature_forecast. Edit this icon and set the following parameters:


The analysis data was valid for 3 days ago; this new icon retrieves a 48-hour forecast data generated 5 days ago, so it is also valid for 3 days ago. You don't need to separately execute and visualise the icon - if you visualise it, the data will automatically be retrieved first. The plot title will verify that this data is valid for the same date and time as the analysis data. It also contains the same set of vertical levels.

Compute the forecast-analysis difference

Create a new Simple Formula icon. Rename it to fc_an_diff. Edit the icon, ensure that the first FORMULA option is selected (F+G) and that the operator is minus ( - ). Drop your temperature_forecast icon into the Parameter 1 box, and drop temperature_analysis into the Parameter 2 box. Save the icon and visualise it. The difference will be computed and the result plotted. Note that all 6 fields in each data icon are used in the computation - the result is a set of 6 fields. The solutions folder contains two Contouring icons which can be used to show the differences: select both pos_shade and neg_shade with the mouse and drop them both together into the Display Window (see Figure 7). It is also possible to drop them one at a time, but they do not accumulate - one will replace the other.

Automating the whole procedure

Ensure that the difference fieldset is visualised with the contouring applied. To generate a Metview Macro script from this plot, click the Generate Macro button (also available from the File menu). A new Macro script will be generated - have a look at it to confirm that it contains code to retrieve all the data, compute the difference and plot the result. Run the macro to obtain the plot, either by using the Run button from the Macro Editor, or by selecting visualise from the icon's context menu). By default, the macro is written so that it will produce an interactive plot window; it will generate a PostScript file if it is run with the execute command, or if it is run from the command line:

metview -b  <macro-name>

Scroll Pagebreak

Metview Macro is a rich, powerful scripting language designed for the high-level manipulation and plotting of meteorological data. For examples of the available functions, see List of Operators and Functions. The code generated automatically above is intended as a starting point only - usually at least some editing will be required in order to make the code more streamlined for your needs.
Figure 2 - the Mars Retrieval icon editor

Figure 3 - the GRIB Examiner

Scroll Pagebreak

Scroll pdf only
Figure 4 - a default map plotFigure 5 - map plot with shaded contours

Image Modified

Image Modified

Scroll pdf ignore
Figure 4 - a default map plot

Figure 5 - map plot with shaded contours

Figure 6 - cross section plot of data

Scroll Pagebreak

Figure 7 - difference plot with two contour icons



This exercise introduces ODB data and some ways that Metview can use it. To save time, we will mostly use pre-prepared icons. Enter the ODB folder to do these exercises.

Retrieving the ODB data

The 'ret_temp' MARS Retrieval icon is already prepared for you to fetch Land TEMP ODB data from MARS from 3 days ago. Edit the icon to see which parameters are set. The most important ones are these:

TypeMFBMondb feedback
Reportype16022land TEMP

Close the icon editor and perform the data retrieval by choosing execute from the icon's context menu. Right-click examine the icon to bring up Metview's ODB Examiner tool. Here you can see the metadata (Columns tab) and the actual data values themselves (Data tab). Close the ODB Examiner.

Save a local copy of the ODB data to the current folder by right-clicking Save result on the ret_temp icon; save as 'temp.odb'. A few seconds later an ODB Database icon (Figure 12) with the given name will appear at the bottom of your folder. We will work with this to avoid repeating the retrieval.

Using the ODB Visualiser

We will select and visualise the 500 hPa temperature values from our ODB using the 'vis_temp' ODB Visualiser icon.

Now edit the vis_temp icon.

First, drop your ODB Database icon into the ODB Data field.

Next, specify the where statement of the query in the ODB Where parameter as:

Code Block
varno = 2 and vertco_reference_1=50000

Save these settings, then right-click visualise the 'vis_temp' icon to generate the plot. Then drag the the provided Symbol Plotting, CoastlinesLegend and Text Plotting icons into the plot for further customisation. Metview's plot window has many tools for inspecting data values, described in detail in the standalone tutorial "Using ODB with Metview". Do not close the plot window yet.

Overlaying with GRIB data

The 'fc.grib' GRIB icon contains 12 h global forecasts of temperature and wind at different vertical levels, valid for the date and time of our TEMP ODB data.

To overlay the 500 hPa temperature forecast we need to filter the matching field from the GRIB file. The 't500_fc' GRIB Filter icon is already already set up to perform this task. Just drag 't500_fc' into the plot, then drag the 't_contContouring icon into the plot as well to customise the contour lines (Figure 13).

Further ODB work

If you have time, inspect and run the supplied macros:

  • '' - computes and plots the difference between the ODB observation data and the GRIB model forecast
  • '' - extracts U and V wind components from the ODB data, converts to geopoints format and plots the result
  • '' - computes and plots a tephigram for a given station ID

The results can be seen in Figure 14.

Figure 12 - ODB and ODB Visualiser icons

Figure 13 - ODB and GRIB data overlaid

Figure 14 - further ODB plots