The examples below are kindly provided by Paul Poli and can be executed with the example ODB file conv_preliminary.odb. The examples assume the bin directory of ODB API installation is on your $PATH.

Which station identifiers are in the ODB file?
$ odb sql 'select distinct statid' -i $odbfile

 

What is the list of columns (or keys) available in the file?

$ odb header $odbfile

 

What geophysical variables are in the ODB file?

$ odb sql 'select distinct varno' -i $odbfile

 See http://apps.ecmwf.int/odbgov/varno/ for description of numeric values of varno, for example:

varno=1 => geopotential

varno=2 => upper air temperature

varno=3 => upper air meridional wind

varno=4 => upper air zonal wind

varno=7 => specific humidity

varno=29 => upper air rel. humidity

varno=39 => 2m temperature

varno=40 => 2m dew point

varno=41 => 10m meridional component

varno=42 => 10m zonal component

varno=58 => 2m relative humidity

varno=59 => upper air dew point

varno=111 => wind direction

varno=112 => wind speed

 

Count the number of temperature records:

$ odb sql 'select count(*) where varno=2' -i $odbfile

count(*) is an aggregation function. Based on the other keys present in the SQL query (here: filtering to select only the temperature entries), each population of identified entries see the data subjected to the aggregation function.

Count the number of temperature records, this time per station identifier, where the observation values are not missing:

$ odb sql 'select count(*), statid where varno=2 and obsvalue is not NULL' -i $odbfile

Get, at one station, the observation count and average temperature observation value by pressure level bins of 100 hPa each, showing also the average pressure in each pressure bin:

$ odb sql 'select count(*), avg(fg_depar), floor(vertco_reference_1/10000.0), avg(vertco_reference_1/100.0) where varno=2 and statid="10739" and fg_depar is not null' -i $odbfile

See full  list of aggregate functions.

Get, at one station, the observation count and mean observation minus first-guess departure for meridional wind and zonal wind near 500 hPa:

$ odb sql 'select count(*), avg(fg_depar) where varno in (3,4) and statid="10739" and vertco_reference_1>=45000. and vertco_reference_1<55000. and fg_depar is not null' -i $odbfile