Versions Compared

Key

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

...




The data values stored in the ODB can be also inspected in the ODB Examiner (this feature does not work for ODB-1). Just click on the Data tab to see the data values. If there are too many values to be shown the ODB Examiner displays the data items in blocks. The actual size of the data blocks (in terms of rows) can be seen at the bottom of the interface next to the data block navigation buttons. Data blocks were introduced to reduce memory usage since the ODB Examiner has to keep in memory all the values shown in the Data tab.


 

Note
titleData blocks

Each column in the Data tab can be sorted by clicking on the column heading. However, please note that sorting is enabled only if all the available data values can be displayed at once, i.e. no data blocks are to be used. By default the ODB Examiner starts splitting the data into data blocks if more than 60 MB is needed to store the data values in memory. You can override this default value in the Configure dialog available from the Settings menu in the menu bar.

 

Symbol Plotting on Maps


In this exercise we will retrieve and plot the brightness temperature values for channel 5 from our 'AMSUA.odb' database. Please open folder 'tb' inside folder 'odb_tutorial_4.1' to start the work.

...

The simplest way to plot ODB data in Metview is to use the ODB Visualiser icon.

Image Added

It performs the query, defines which ODB columns should be interpreted as latitude, longitude and value(s) and specifies the plot type (symbol or wind plotting), as well.

Image Removed
Create a new ODB Visualiser icon (right-click in the desktop when no icons are selected and use the New icon ... menu) and rename it 'tb_plot'.

First, open its editor and set ODB_PLOT_TYPE Odb Plot Type to 'Geo Points' to indicate that we want to plot the values on a map.

Second, drop your 'AMSUA.odb' database icon into the ODB_DATA Odb Data field. This specifies the database for which the query will be performed.

...


In the ODB Visualiser interface this query cannot be typed in directly but has to be split into the following individual items:

Odb Latitude Variable:specifies the name of the column holding the latitude data in the SELECT statement (here lat@hdr).
Odb Longitude Variable:specifies the name of the column holding the longitude data in the SELECT statement (here lon@hdr)
Odb Value Variable

...

specifies the name of the column holding the value data in the SELECT statement (here obsvalue@body)
Odb Where

...

specifies the WHERE statement. In our example it is as follows:

...

vertco_reference_1@body

...

=

...

5

...


Last, we have to specify the units of the geographical co-ordinates (here lat@hdr and lon@hdr) in the Odb Coordinates Unit field. It is necessary since Metview requires geographical co-ordinates in degrees, but there is no general way to find out their units in an ODB database. Instead an explicit declaration is needed from the users. Our database stores co-ordinates in degrees. So, to correctly interpret our co-ordinate values Odb Coordinates Unit should be set to 'Degrees' (which is the default value so we do not need to change it).

...




We will change the plot by using markers instead of numbers and change the colour, as well. Let's create a new Symbol Plotting icon (it can be found in the Visual Definitions icon drawer, you may need to scroll the drawers to the right).

 

Image Removed

right-click in the desktop when no icons are selected and use the New icon ... menu):

Image Added

Rename it 'symbol' then edit it, by setting the following parameters:

 

Legend

On

Symbol Type

Marker

Symbol Table Mode

Advanced

Symbol Advanced Table Max Level Colour

Red

Symbol Advanced Table Min Level Colour

Blue

Symbol Advanced Table Colour Direction

Clockwise

Symbol Advanced Table Marker List

3

Symbol Advanced Table Height List

0.15

...




We used the Symbol Table Mode in our icon and set it to 'Advanced' which enabled us to automatically define intervals with a separate maker type, colour and size. These settings work in a similar way as in the Contouring icon.
Image Removed Our palette was automatically generated from a colour wheel

Image Added

by interpolating in clockwise direction between Symbol Advanced Table Min Level Colour and Symbol Advanced Table Max Level Colour.
The identifiers of the available symbol markers are summarised in the table below.

Image Added

Note

Please note that the rendering speed of the markers can be significantly different and using a simpler symbol (in terms of rendering) can greatly reduce the plotting time. For example, the usage of marker 3 (plus sign) can result in much faster plot generation than that of marker 15 (filled circle).

...

Changing the Default Symbol Plotting Icon

...

So far we have used the default legend settings, which resulted in a continuous legend. Now we will change our legend so that it could display a histogram showing the data distribution across the data intervals used in the symbol plotting.
Let's create a new Legend icon (it can be found in the Visual Definitions icon drawer).:

 

Edit it, by setting the following parameter:

 

Legend Display Type

Histogram


Now drop the icon into the plot to see how the legend has been changed: it now contains an additional area holding the histogram.


Fixing the Symbol Plotting Intervals

...

The title of the ODB plot was automatically generated. It contains the database name (in this case it is a temporary file, the result of the query) and some statistics. To use a custom title we need a Text Plotting icon (it can be found in the Visual Definitions icon drawer).
This time you do not need to create a new icon since there is one called 'title' already prepared for you. Edit this icon to see how the title is constructed. Then simply drag it into the Display Window and see how your title has been changed.

Inspecting the Data Values

 

 

Data values at the cursor position can be inspected with the Cursor Data Tool, which can be activated by pressing on the gun-sight icon in the toolbar of the Display Window. The Cursor Data Tool displays the co-ordinates of the current cursor position and the information for the nearest data point to this position.


You may find hard to use the Cursor Data Tool for ODB since it is complicated to properly position the cursor in data dense regions in the plot. To overcome this difficulty you need to launch the Magnifier by pressing on the magnifier icon in the toolbar and navigate it to your area of interest in the plot.

Now if you move the cursor inside the magnifying glass it is significantly easier to distinguish the individual data points since you navigate the cursor inside a closed-up region.
Image Modified

Wind Plotting on Maps


In this exercise we will retrieve and plot wind vectors for aircraft data above 250 hPa using the ODB Visualiser icon.

Note

Please note that the ODB Visualiser icon needs to retrieve both wind components within a single ODB/SQL query. This type of query is working fine for ODB-1 databases. However, it is only working for ODB

...

databases

...

if the wind components are stored in different columns (but this is not the general case). Therefore we will demonstrate wind plotting here with an ODB-1 database ('CCMA.obs') and show an alternative way for ODB

...

data in Part 7 of the tutorial.

Writing a Wind Data Query

...

Code Block
languagesql
SELECT
 lat@hdr,
 lon@hdr,
 obsvalue@hdr,
 obsvalue@hdr#1
 FROM hdr, body
 WHERE
 obstype@hdr = 2 and
 varno@body = 3 and
 varno@body#1 = 4 and
 vertco_reference_1@body < 25000 

...

Now open folder 'wind' inside your 'odb_tutorial_4.1' folder. Create a new ODB Visualiser icon and rename it 'wind_plot'. Open its editor and set ODB Plot Type to 'Geo Vectors' to indicate that we want to plot vectors on a map.
Then, change the icon to perform the query specified above for the 'CCMA.obs' icon located in this folder. This can be done in a similar fashion to our symbol plotting example in Part 2 . The main difference is that this time we plot wind data, so we need to work with the u and v wind components instead of scalar data values.




First, drop your 'CCMA.obs' ODB Database icon into the Odb Data field. This defines the database for which the query will be performed.

Second, we need to specify the query by setting the following individual items:

Odb Latitude Variable

...

specifies the name of the column holding the latitude data in the SELECT statement (here lat@hdr)
Odb Longitude Variable

...

specifies the name of the column holding the longitude data in the SELECT statement (here lon@hdr)
Odb X Component Variable

...

specifies the name of the column holding the u wind component data in the SELECT statement (here obsvalue@body)
Odb Y Component Variable

...

specifies the name of the column holding the v wind component data in the SELECT statement (here obsvalue@body#1)
Odb Value Variable

...

specifies the name of the column whose values willl be used to generate the colour palette for the wind plotting. We leave this item empty because it instructs Metview to use the wind speed for this purpose.
Odb From

...

specifies the FROM statement (it is only needed for ODB-1 databases).
Odb Where

...

specifies the WHERE statement. In our example it is

...

 

...

languagesql

...

as follows:

obstype@hdr = 2 and

varno@body = 3 and

varno@body#1 = 4 and

vertco_reference_1@body

...

<

...

25000

...


Last, Odb Coordinates Unit has to be set to 'Radians' since our database stores geographical co-ordinates in radians.


Having finished editing your icon editor it should look like the picture on the previous page.

...

Right-click and visualise the icon to plot the retrieved data (please note that you can directly visualise this icon by skipping the execute step). This will bring up the Metview Display Window using the default visualisation assigned to wind plotting (your default settings might be different to the one used to generate this plot).




We will change the plot by applying a colour palette according to the wind speed and change the wind arrow size and thinning, as well.
Let's create a new new  Wind Plotting icon (it can be found in the Visual Definitions icon drawer, you may need to scroll the drawers to the right).:


Rename it 'colour_wind' then edit it, by setting the following parameters:

 

Wind Field Type

Arrows

Wind Advanced Method

On

Wind Arrow Unit Velocity

50.

Wind Thinning Factor

1.0

Wind Advanced Colour Max Level Colour

Red

Wind Advanced Colour Min Level Colour

Blue

Wind Advanced Colour Direction

Clockwise


Now drop this icon into the plot to see the effect of the changes.



We used the Wind Advanced Method in our icon that enabled us to automatically define wind speed intervals and assign a nice palette to them. These settings work in a similar way to the Contouring icon. Please note that our palette was automatically generated from a colour wheel by interpolating in clockwise direction between Wind Advanced Colour Min Level Colour and Wind Advanced Colour Max Level Colour.

...

If you zoom in and out of different areas you can see that the palette does not stay constant. The default behaviour is to create 10 interval levels within the range of data actually plotted. As the area changes, so does the range of values being plotted.
Now we will create a palette which will not be altered when we change the area. Copy the Wind Plotting icon (either right-click + duplicate, or drag with the middle mouse button), and rename the copy 'fixed_wind' by clicking on its title. Edit the icon and make the following changes:

...

To change the automatically generated ODB title you need to simply drag an already prepared Text Plotting icon called 'title' into the Display Window.

...

Create a new ODB Visualiser icon and rename it 'scatter_plot' then open its editor.


First, set ODB Plot Type to 'Xy Points' to indicate that we want to plot symbols in a Cartesian view.


Second, drop your 'AMSUA.odb' ODB Database icon into the Odb Data field. This specifies the database for which the query will be performed.


Last, we need to specify the ODB/SQL query and the way the columns are to be interpreted to generate the plot. We want to perform the following query:

...


In the ODB Visualiser interface this query cannot be typed in directly but has to be split into the following individual items:

   
Odb X Variable

...

specifies the name of the column holding the x data in the SELECT statement (here fg_depar@body)

...

 
Odb Y Variable

...

specifies the name of the column holding the y data in the SELECT statement (here

...

an_depar@body)

...

 
Odb Value Variable

...

specifies the name of the column whose values will be used to generate the colour palette for the scatter plot. We will leave this item empty because we do not want to use this feature in this example. 
Odb Where

...

specifies the WHERE statement. In our example it is as follows:

...

vertco_reference_1@body

...

=

...

5

...

 


Having finished the modifications your icon editor should look like this:


Running the Query

Save your ODB Visualiser icon (Apply) then right-click and execute to run the query. Within a few seconds the icon should turn green indicating that the retrieval was successful and has been cached. Now your icon behaves exactly like an ODB Database icon. Right-click examine to look at its content.

...

Right-click and visualise the icon to plot the data (please note that you can directly visualise this icon by skipping the execute step). This will bring up the Metview Display Window using the default visualisation (black circles) assigned to this kind of plots.


We can change the symbol (its type, colour and size) used for the plot with a Symbol Plotting icon. This time you do not need to create a new icon since there is one called 'scatter_symbol' already prepared for you. Edit this icon to see its settings then simply drag it into the Display Window and see how your plot has been changed.


Defining Binning

The main problem with our scatter plot is that it has dense regions where the data distribution is really hard to see. To overcome this difficulty we will create a density map out of our scatter plot. We can achieve it by turning our scattered dataset into a gridded dataset via binning. Binning means that we split the scatter plot area into grid cells by defining bins along the horizontal and vertical axes. Then for each cell we assign the number of points it contains as a grid value.
We will define the properties of the binning via the Binning icon. Image Removed

Image Added

Let's create a new Binning icon (it can be found in the Visual Definitions icon drawer, you may need to scroll the drawers to the right). Rename it 'bin_100' then edit it, by setting the following parameters:

...

With these settings we will split the data value range for both the x and y axes into 100 bins to generate the gridded dataset.


Now we will create a new ODB Visualiser icon to be used with our Binning icon. Copy your 'scatter_plot' icon (either right-click + duplicate, or drag with the middle mouse button), and rename the copy 'bin_plot' by clicking on its title. Edit the icon and make the following changes:


Set ODB Plot Type to 'Xy_Binning' to indicate that we want to generate a new dataset with binning and want to plot it in a Cartesian view.

 

Then, drop your 'bin_100' Binning icon into the Odb Binning field as the picture below illustrates it.


Visualising the Binned Dataset

Right-click and visualise icon 'bin_plot' to retrieve the data, perform the binning and plot the resulting dataset. This will bring up the Metview Display Window using the default contouring visualisation assigned to gridded datasets (your default contouring settings might be different to the one used to generate this plot).



Unfortunately
Since isolines is not the desired visualisation type in our case (our data is not smooth enough) so we need will to further customise the contouring settings. The best choice for us is to use grid shading since it applies shading for the grid cells themselves and we get the correct representation of our grid in the plot. (Please note that grid shading is different to cell shading, since the latter always involves an interpolation to define a new set of grid cells that the shading is applied for.)

Let's create a new Contouring icon (it can be found in the Visual Definitions icon drawer, you may need to scroll the drawers to the right).


Rename it 'bin_grid_shade' then edit it, by setting the following parameters:

...

Now drop this icon into the plot to see the effect of the changes.



In our Contouring Contouring icon we set the minimum value to '1.' to exclude grid cells containing no points at all and used 20 intervals between the minimum and the maximum to define the colour palette. Please note that our palette was automatically generated from a colour wheel by interpolating in clockwise direction between Contour Shade Min Level Colour and Contour Shade Max Level Colour.

...

We will further customise the plot by changing the axis value ranges and adding axis labels and grid-lines to it. To change these properties we need a Cartesian View icon (it can be found in the Visual Definitions icon drawer).


This time you do not need to create a new icon since there is one called 'scatter_view' already prepared for you. Edit this icon to see how the view is constructed (please note that the axis properties are defined via the embedded Horizontal Axis and Vertical Axis icons). Then simply drag it into the Display Window and see how your plot has been changed.

...

To change the automatically generated ODB title you need to simply drag an already prepared Text Plotting icon called 'title' into the Display Window.

...

  • macro_filter: it shows how to manipulate ODB MARS data with the odb_filter function (see Part 6 ) to derive new datasets.
  • macro_plot: it shows how to plot data from an ODB MARS retrieval. It is basically the macro equivalent of the 'plot_hirs' ODB VisualiserVisualise