Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Confirmed.

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?

...

Code Block
languagebash
$ odb sql 'select distinct statid' -i $odbfile

...

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

 

Code Block
$ odb header $odbfile

...

What geophysical variables are in the ODB file?

 

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

...

Count the number of temperature records:

 

Code Block
$ 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:

 

Code Block
$ 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:

...

Code Block
$ 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:

...

Code Block
$ 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