Versions Compared

Key

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

...

Code Block
cp -R /home/graphics/cgx/tutorials/odb_tutorial_4.1  $HOME/metview

You should now see a odb_tutorial_4.1 folder appearing in your main Metview folder. This contains all the icons needed for the tutorial and the solutions as well. You will work in this folder so open it up. You should see the following contents:

...

Open folder 'database' inside your 'odb_tutorial_4.1' folder (double-click or right-click, edit). Here you will find all the ODB Database icons used in the tutorial.

...

ODB has two binary representations: there is the current format (ODB) which has a "flat" structure, an and the older hierarchical format (ODB-1) which is stored in a directory structure instead of a single file. Metview uses the same icon for both ODB formats, hiding the differences between them and providing the users with an interface which is format-transparent. However, please note that wind plotting presently requires different approaches for the ODB and ODB-1 formats, respectively (see Part 3 and Part 7 the wind plotting exercises (1, 2) for details on the differences).

The ODB Examiner

 

Right-click on your 'CCMA.obs' ODB Database icon and select examine from the icon menu. This will start the ODB Examiner application that displays the meta-data of the database. By default you should see the Tables tab of the interface showing the ODB table hierarchy. This hierarchy only exists only for the ODB-1 format (so we can see that our 'CCMA.obs' icon represents an ODB-1 database). By clicking on a table name the columns belonging to the selected table are displayed in the right hand side of the interface. There are two more tabs in the interface: the Columns tab showing the list of all the available columns and the SET Variables tab providing the users with the list of pre-defined ODB variables. Explore these tabs and then close the ODB Examiner.


Now right click and examine icon 'AMSUA.odb'. It points to an ODB database (just like icon 'AIREP.odb'). Since there is no table hierarchy to be shown the list of all the available columns is displayed by default (Columns tab).

Image Added Image Removed
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. Image Removed

Image Added

 

Note

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.

...

Anchor
symbol_plotting
symbol_plotting
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 ODB Visualiser Icon

...


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.

Anchor
wind_plotting
wind_plotting
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 here.

Writing a Wind Data Query

...

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.

...

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

Anchor
scatter_plot
scatter_plot
Scatter Plots

In this exercise we will generate scatter plots for the analysis and first guess departures values of brightness temperature. As in the previous exercises we will use channel 5 from our 'AMSUA.odb' database. Please open folder 'scatter' inside folder 'odb_tutorial_4.1' to start the work.

About Scatter Plots

...

In this example we will write the macro equivalent of the symbol plotting exercise we solved in Part 2 : we would like to retrieve and plot the brightness temperature for channel 5 for our 'AMSUA.odb' database. We will work in folder 'tb' again.

...

Now, if you run this macro you should see your modified plot in the Display Window.
 

Note

The macro equivalent of the wind plotting exercise in Part 3 and that of the scatter plot exercise in Part 4 exercises can be written in a very similar way to what was shown above for symbol plotting. The solutions can be found and studied in folder 'wind_solution' and 'scatter_solution', respectively.

Anchor
#odb_filter
#odb_filter
The ODB Filter Icon

In this exercise we will learn about the ODB Filter icon.

...

As a demonstration of the ODB Filter icon, we will compute and plot the analysis increments in observation space for the brightness temperature. Like in Part 2 the symbol plotting exercise we will work again with channel 5 from our 'AMSUA.odb' database. Because our database does not contain the analysis increment we will compute it as the difference of the analysis departure and the first guess departure. First, we will write and perform the query needed for the exercise via the ODB Filter icon, then we will write a macro to do the computations and plot the final result.

The ODB Filter Icon

Open folder 'filter' inside your 'odb_tutorial_4.1' folder. Create a new ODB Filter icon and rename it 'filter_dep'. Open its editor and perform the following steps:

...

Now, if you execute this macro (right-click execute or click on the Play button in the Macro editor) you should see a Display Window popping up with this result (your plot might look different depending on your default symbol plotting settings):

Improving the Plot

In our plot the large increments (in terms of absolute value) are not clearly highlighted because the plot is dominated by the bright green colour assigned to the near-zero values. To enhance the plot we would like to apply another colour palette by using:

...

You will see an enhanced plot as shown below:

Modifying the Macro

We are satisfied with the new colour palette and with the title as well, so in the last step of the exercise we will add these new settings to our macro.

...

Now, if you visualise the macro you should see your modified plot in the Display Window.

Anchor
wind_plotting2
wind_plotting2
Wind Plotting with ODB Data

In this exercise we will present an example macro to show how to plot ODB wind data if both the wind components are stored in the same column in the database. We will demonstrate this plotting technique on aircraft wind data above 250 hPa from our 'AIREP.odb' ODB-2 database.

...

Open folder 'wind_odb2' inside your 'odb_tutorial_4.1' folder. You will find here the 'AIREP.odb' ODB Database icon and a macro called 'plot_wind'. If you right click and visualise the macro it will retrieve and plot the wind data from the database. You should see a Display Window popping up with the result (your plot might look different depending on your default wind plotting settings):

...

In Metview we can access ODB from MARS by using the standard MARS Retrieval icon. This icon is located in the Data Acces icon drawer.

Now create a new MARS Retrieval icon by dragging it into your folder and rename it 'mars_hirs'. We will edit this icon in order to retrieve HIRS data available for yesterday at 00 UT and also use the filter option to select only a subset of the archived columns. Our retrieval can be written as follows:

...

Now edit your MARS Retrieval icon so that it could perform this retrieval.
Remarks  

  Please be aware that the Obsgroup parameter in the icon editor does not contain the string "hirs". Instead it offers a list of numerical IDs. The ID of HIRS is 2.

...

 

Running the Retrieval

Save your MARS Retrieval 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 and all the relevant techniques introduced in the previous Chapters (Part 1 - Part 7 ) chapters can be used with it. It means that you can examine, visualise and manipulate the data it holds.

  • To examine: just right-click examine to look at its content.
    To visualise: you need to use an ODB Visualiser icon (see Part 2 see here). There is one, called 'plot_hirs', already prepared for you in the folder. It is to plot the observation values for channel 5 on a map. Just edit this icon and drop your MARS Retrieval icon into the ODB Data field. Save the icon (Apply) then right-click and visualise to generate the plot.
  • To manipulate: you need to write a macro (please read the next section about how to do it).

...

Macro Usage

The usage of ODB MARS retrievals in Metview macro follows the same principles as in the interactive mode. In macro we work with the macro command equivalent of the MARS Retrieval icon which is retrieve.

Now we will write a simple macro to retrieve our HIRS ODB data from MARS and compute and print the minimum, maximum and mean of the observed data values.

Create a new Macro icon and rename it 'step1'. Open the Macro editor (right-click edit) and move the cursor somewhere below the #Metview Macro line at the top. Then drop your 'mars_hirs' icon into the editor. You should see something like this (after removing the comment lines starting with # Importing):

Code Block
languagepy
#Metview Macro 
 mars_hirs = retrieve(
 type : "mfb",
 repres : "bu",
 obsgroup : "hirs",
 time : 00,
 resol : "",
 filter : "select lat, lon, obsvalue, vertco_reference_1"
 ) 

This piece of code performs the retrieval and stores the result in an ODB database which is now represented by the mars_hirs macro variable.

In the next step we will use the values built-in macro function to read the ODB data values into a vector.

Code Block
languagepy
val = values(mars_hirs,"obsvalue@body") 

The last step is to compute some statistics for vector val and print them the into the standard output.

Code Block
languagepy
min_v=minvalue(val)
 max_v=maxvalue(val)
 mean_v=mean(val)
 print("min: ",min_v," max: ",max_v," mean: ",mean_v) 

...

  • macro_filter: it shows how to manipulate ODB MARS data with the odb_filter function (see Part 6 here) 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 VisualiVisualiser icon