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

Introduction

Metview has much functionality for meteorological data types stored in ECMWF's MARS archive, for example GRIB, BUFR and ODB. But not all data comes in these formats. Therefore Metview has facilities to handle various other data types, which we will explore here.

XXXX Download data.

Visualiser Icons

Some formats, such as GRIB, are easy to visualise in Metview - just right-click, Visualise. This is because they are quite constrained in their contents and have enough standardised meta-data for a program to understand how they should be plotted. Some other formats, such as netCDF and tables of ASCII data are not easily interpreted for automatic plotting (which variables/columns should be selected and what do they represent?). Metview introduces the concept of the Visualiser icon, which we will use in some of the following examples.

NetCDF

NetCDF is a binary file for storing multi-dimensional arrays of data and has enjoys wide academic usage.

Examining netCDF

Right-click on the supplied netcdf.nc icon and choose examine to see its structure. It consists of multi-dimensional variables, each of which has its own set of attributes; the file also has a set of global attributes.

Visualising netCDF

XXXX

Create a new NetCDF Visualiser icon. Edit it and drop the netcdf.nc icon into the NetCDF Data field. Set the following parameters:

Netcdf Plot TypeGeo Matrix
Netcdf Latitude Variablelatitude
Netcdf Longitude Variablelongitude
Netcdf Value Variablev2d

Save the changes, and visualise this new icon. See how the settings in the visualiser icon correspond to the variable names in the data. Now visualise another field from the same file. Use the supplied shading_20_levels icon on the plot.

Handling netCDF in Macro

In Macro, the read() function reads the given netCDF file into a netcdf variable.

Once read in, Metview can perform various manipulations on the data. These are based on the concept of the current variable. Out of the N variables contained in a netCDF file, one is always set to be the current variable. Functions and operators acting upon the netCDF file will act only upon the current variable.

Have a look at the variable v2d inside the netCDF file - its values are stored in degrees Kelvin. As an exercise, we will change them to Celcius. Type the following code into a new Macro:

nc = read('netcdf.nc')
setcurrent(netcdf, XXX)
nc = nc - 273.15

We can then write this to a new file:

 write('new_netcdf.nc', nc)

The only difference between this and the original file should be in the values of the variable v2d. Visualise the new file to check that its values are in Celsius.

Operations can also be performed between two netCDF files (e.g. diff = nc1 - nc2), noting that the operation is performed using only the current variable in each.

Various meta-data can be extracted from a netCDF - try the following in a macro:

nc = read('netcdf.nc')
print('Variables: ', variables(nc))
print('Global attributes: ', global_attributes(nc))

Exporting Cross Sections and Profiles as netCDF

Metview uses netCDF internally for the results of some computations. In particular, the analysis views do this, but their result data is not available to the user. Therefore, each of these views has a corresponding Data view - for example, there exist both a Cross Section View and a Cross Section Data icon. If the intention is to simply plot the result, then the View icons are more useful. But to store the result data, the Data icon is needed.

Geopoints

Geopoints is the ASCII format used by Metview to handle spatially irregular data (e.g. observations). There are a number of variations on the format, but the default one is a 6-column layout. The columns do not have to be aligned, but there must be at least one whitespace character between each entry.

This example shows a geopoints file containing dry bulb temperature at 2m (PARAMETER = 12004).

 

#GEO
PARAMETER = 12004
lat        long    level  date       time    value
#DATA
36.15      -5.35     0   19970810    1200    300.9
34.58      32.98     0   19970810    1200    301.6
41.97      21.65     0   19970810    1200    299.4
45.03       7.73     0   19970810    1200    294
45.67       9.7      0   19970810    1200    302.2
44.43       9.93     0   19970810    1200    293.4

If you have observation data which you wish to import into Metview, Geopoints is probably the best format because:

  1. it is easy to write data into this format
  2. Metview has lots of functions to manipulate data in this format

Variants of the format allow 2-dimensional variables to be stored (e.g. U/V or speed/direction wind components), and another variant stores only lat, lon and value for a more compact file.

Examine the supplied geopoints.gpt icon to confirm the contents of the file. The columns are sortable. You may wish to open the file in an external text editor to see exactly what it looks like.

Visualise the icon. The visdef used for geopoints is Symbol Plotting, and its default behaviour is to plot the actual numbers on the map. This can become cluttered, and text rendering can be slow. Drop the supplied coloured_symbols icon into the Display Window to get a better view of the data.

 

 

  • No labels