Skip to content
Thomas Nipen edited this page Mar 31, 2020 · 27 revisions

Titanlib is a library of automatic quality control routines for weather observations. It emphases spatial checks and is suitable for use with dense observation networks, such as citizen weather observations. It is written in C++ and has bindings for python and R. The library consists of a set of functions that perform tests on data.

Functions have different signatures, but in general have the following inputs:

  • station data: latitude, longitude, elevation
  • observations: values
  • parameters for test: e.g. radius, threshold
  • outputs: status, flags

As an example, consider the buddy check:

status = buddy_check(lats, lons, elevs, values, radius, flags)

Station metadata

The three metadata vectors must be of identical size. Latitude and longitude are in decimal degrees. Use negative values for South and West values.

Station metadata and observations are vectors with one value for each station. For gridded observation sets, the grid needs to be serialised into one vector first.

Parameters

Parameters can either be scalars or vectors. If they are scalar, the single value is valid for all observations. If the parameter is a vector, then it can either be of length (in which case the value is broadcast to all observations) or of the same length as the observations. In the latter case the parameters can vary from station to station. This is common if the set of observations come from different data sources with different characteristics.

Return values

Each function returns a status flag. A value of 0 means the test was successful. Any other code means there was an error performing the test. This usually means that the inputs are invalid, such as mismatch between sizes of arrays (e.g. different number of latitudes than longitudes), or non-sensical parameters such as anegative radius.

The function also writes the flags for the test in the flags variable, which is passed by reference. This variable need not be resized to the correct size before calling the function, the function will do this.

Clone this wiki locally