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.
$ odb sql 'select distinct statid' -i $odbfile |
$ odb header $odbfile |
$ 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
$ 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.
$ odb sql 'select count(*), statid where varno=2 and obsvalue is not NULL' -i $odbfile |
$ 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.
$ 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 |