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 44 Next »

Introduction

A fundamental concept in Metview is the View. A View specifies the following definitions in a Metview plot:

  • type of visualisation (e.g. geographical map, cross section, vertical profile, tephigram)
  • parameters specific to that plot type (e.g. geographical area, cross section line, min/max axes values)
  • plot position within the page (several plots can share a page)
  • how to overlay different data in the same plot (e.g. icon drop rules, data overlay control)
  • plot decoration (e.g. draw a frame around the plot)

Without a View specification, Metview would not plot anything. If you do not provide a View, then Metview will use a sensible default View.

For instance, you have previously visualised a GRIB icon by just clicking the icon and selecting option visualise.  A  Display Window was automatically generated showing a default Geographical View containing a global map in a Cylindrical projection.

 

(add a picture with 4 views and highlighting the above definitions)

 

Eight Views specifications are currently available:

NameUsage (Used for plotting or Plotting specification for)
Geographical Viewgeographic-based data plots  (default View) (link)
Cartesian View plots that are not to be displayed on a map (link)
Cross Section Viewcross section plots
Vertical Profile Viewvertical profile plots
Average Viewaverage (zonal or meridional) cross-section plots
Annotation Viewtext boxes (link)
Hovmøller ViewHovmøller diagram plots
Thermo Viewthermodynamic diagram plots

 

The Geographical View   

This is the default View for plotting geographic-based data. This View was discussed previously in A Quick Tour of Metview. 

The Cartesian View    

This will be covered in another session: Graph Plotting in Metview.

The Cross Section View    

This icon is a plotting specification for cross section plots. 

Now create a new Cross Section View icon. Visualise it and drop the t_fc24.grib icon into the Display Window. A default cross section along the Equator is generated. This is an alternative way to view your data - instead of a geographical plot for instance.

Inspect the GRIB icon (right-click on it and choose examine) to see the type of input data this View requires,

Edit the Cross Section View icon and change the transect line (coordinates along which the cross-section is calculated).- click on the Geography Tool button to bring up an editor (or type the coordinate by hand). Save your changes in the Cross Section View icon and use it to re-visualise the data with this new cross section.

Note that you can still drag any valid Contouring icons you may have into the Display Window when visualising a cross section. For instance, apply the given shade icon. You may want to customise it and try different configurations.

Notice that a Cross Section View icon editor contains a place for an embedded Thermo Grid icon, which configures the background attributes of the thermodynamic diagram.

The Vertical Profile View    

This icon is a plotting specification for vertical profile plots.

Create a new Vertical Profile View icon. Visualise it and drop the t_fc24.grib icon into the Display Window. This view shows a vertical profile at a point (or averaged over an area). Experiment with this icon in a similar way to how you did with the Cross Section View icon.

Icon Graph Plotting is the visual definition used for the plotting of graphs (e.g. lines, curves and bar charts). To customise the line displayed in this plot,  create a new instance of this icon and rename it to vdline. Edit it, setting the following parameters:

Graph Line Style

Dash

Graph Line Colour

Black

Graph Line Thickness

5

Apply the changes and drag it into the Display Window.

The Average View    

This icon is a plotting specification for average (zonal or meridional) cross-section plots.

Create a new Average View icon. Visualise it and drop the t_fc24.grib icon into the Display Window. A default meridional average over the globe cross-section is generated. Experiment with this icon in a similar way to how you did with the Cross Section View icon.

You can use a Contouring icon, e.g. the shade icon, to style the contours of the plotting.

The Annotation View    

This icon provides a container for user-defined text boxes.

Create a new Annotation View icon and visualise it.  The user text is provided by means of a Text Plotting icon. Create a new instance of this icon and rename it to note1. Edit it, setting the following parameters:

Text Line 1

Metview Training Course

Text Mode

Positional

Text Box X Position

10

Text Box Y Position

10

Text Box X Length

5

Text Box Y Length5

Apply the changes and drag the note1 icon into the Display Window.

Experiment with this icon by changing other parameters, for instance, the font style and size. Also, multiple Text Plotting icons can be placed in this View. Duplicate the note1 icon, rename it, customise it (remember to define an appropriate text box) and drag it into the Display Window.

The Hovmøller View   

This icon is a plotting specification for Hovmøller diagram plots along a specified arbitrary transect line or a rectangular area. The diagram displays a two-dimensional graph with latitude or height as one axis and time as the other.

Create a new Hovmoeller View icon. Visualise it and drop the t_ts.grib icon into the Display Window. A default diagram derived from a transect line along the Equator is generated.

Examine the GRIB icon to see the sort of input data this View requires,

Three types of Hovmøller diagrams can be produced:

  1.  Area Hovm     - diagram derived from an input rectangular area
  2.  Line Hovm      - diagram derived from an input transect line
  3.  Vertical Hovm - diagram derived from an input rectangular area and a set of levels.

Experiment with this icon by testing the above types and investigating other input parameters. Type Vertical Hovm requires the following input GRIB data: t_ts_nlevels.grib. Examine and compare this GRIB data with the previous one.

As previously, you can use a Contouring icon to style the contours of the plotting.

The Thermo View   

This icon is a plotting specification for Thermodynamic diagram plots from a suitable GRIB or BUFR data source. In such a diagram, temperature, humidity (represented by the dew point) and wind values are displayed with respect to pressure.

Create a new Thermo View icon. Visualise it and drop the tquv_pl.grib icon into the Display Window. A default diagram related to a geographical location [0,0] is generated.

Inspect the GRIB icon (right-click on it and choose examine) to see the type of input data this View requires. Fields Temperature  and Specific Humidity are mandatory and they will be used to compute the Dew Point parameter. Fieldsets U and V wind components are optional, but if given they will be used to compute the wind vectors. If the data is given in model levels then a Logarithm of Surface Pressure field must be provided too in order to help the conversion to pressure levels fields.

Note that only the Tephigram diagram is currently available, although there are other types of thermodynamic diagrams, such as Skew-T, Emagram and Stuve.

To customise the curves displayed in this plot,  you can apply (or edit it first) icon vdline. The changes will be applied to both lines. The ability to customise each line individually (temperature and dew point) will be available in the future release of Metview.

Icon Wind Plotting is the visual definition responsible for specifying how gridded wind vector data is displayed. It controls features such as wind arrows and wind flags. To customise the wind flags displayed in the plot, create a new instance of this icon and rename it to vdwind. Edit it, setting the following parameters:

Wind Field Type

Flags

Wind Flag Colour

Coral

Wind Flag Length1.3

Wind Flag Thickness

2

Apply the changes and drag it into the Display Window.

 Macro example

To demonstrate the use of the View concept in a Macro language, let's create a program to analyse the vertical structure of temperature changes in time. This exercise reads two forecast steps, computes the differences and visualise the result in a cross section view.

Create a new Macro icon and rename it to xsdiff. Edit it and do the following:

  • drop the t_fc24.grib icon into the Macro Editor. A variable called t_fc24_2e_grib is assigned to the value of the read() command, which reads the GRIB data. Rename the variable to simply be t_fc24.

  • drop the t_fc96.grib icon into the Macro Editor. Rename the variable to t_fc96.

  • compute the differences, e.g. diff = t_fc96.grib - t_fc24.grib
  • drop the two contouring icons, neg and pos, which will be used to show the differences.

  • drop the xs_europe icon into the Macro Editor
  • underneath the generated code, type the following line:
plot(xs_europe,diff,neg,pos)

Your complete macro should look like this:

t_fc96 = read("/home/graphics/cgk/metview//Analysis Views/t_fc96.grib")

t_fc24 = read("/home/graphics/cgk/metview//Analysis Views/t_fc24.grib")

diff = t_fc96 - t_fc24

pos = mcont(
    legend                         : "on",
    contour_level_selection_type   : "level_list",
    contour_max_level              : 10,
    contour_min_level              : 0.1,
    contour_level_list             : [0.5,1,2,4,10],
    contour_shade                  : "on",
    contour_shade_method           : "area_fill",
    contour_shade_max_level_colour : "red",
    contour_shade_min_level_colour : "orange_yellow",
    contour_shade_colour_direction : "clockwise"
    )

neg = mcont(
    legend                         : "on",
    contour_level_selection_type   : "level_list",
    contour_max_level              : -0.5,
    contour_min_level              : -10,
    contour_shade_max_level        : -0.1,
    contour_shade_min_level        : -10,
    contour_level_list             : [-10,-4,-2,-1,-0.5],
    contour_shade                  : "on",
    contour_shade_method           : "area_fill",
    contour_shade_max_level_colour : "greenish_yellow",
    contour_shade_min_level_colour : "blue",
    contour_shade_colour_direction : "clockwise"
    )

xs_europe = mxsectview(
    line : [55,-6,43,16]
    )

plot(xs_europe,diff,neg,pos)

Now run the macro to generate the plot.

Also, inspect the two input GRIB icons (right-click on it and choose examine) to analyse their contents,

Exporting Modules Data

Metview uses a netCDF format internally for the results of some computations (this format will be covered at session: Data Part 2). In particular, most of the previous Views (i.e. Cross Section, Vertical Profile, Average, Hovmøller and Thermo) do this, but their result data is not available to the user. Therefore, each of these Views has a corresponding Data Module view. If the intention is to simply plot the result, then the View icons are more useful. But to store the result data, the Data Module icon is required.

Create both a Vertical Profile View and a Vertical Profile Data icon and edit both to see the differences. All the parameters related to the visualisation of the result are only in the View icon, and the Data parameter exists only in the Data Module icon.

Dealing only with the Vertical Profile Data icon now, drop the supplied input GRIB icon t_fc24.grib into the Data parameter box. Set the Point to whatever you like and save the icon. Now if you right-click and Examine the icon, you will see the resulting netCDF file in the NetCDF Examiner. You can also select Save Result to save the result into a file for storage.

All of this can also be put into a macro, where the resulting netCDF variable can be further manipulated before being written to a file (or visualised).

Write a short macro, named save_vp, which computes a vertical profile from the data (use the Vertical Profile Data icon that you already set up) and writes the result to a file. To write a netcdf variable to a file, the syntax is the same as for any other data type:

write('output_file', data)

Your macro should be 3 lines long (well, 3 commands anyway) - one to read the input GRIB file, one to compute the profile and one to write the result to disk

  • No labels