Skip to content

Latest commit

 

History

History
91 lines (64 loc) · 3.37 KB

README.md

File metadata and controls

91 lines (64 loc) · 3.37 KB

Titanlib

"Latest release" C/C++ CI

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.

Titanlib is currently under active development and the current version is a prototype for testing. Feedback is welcome, either by using the issue tracker in Github, by contacting Thomas Nipen ([email protected]), or by participating to the discussion.

Example of titanlib

Documentation

For more information on how to use Titanlib, check out the wiki. We have also another package, Titantuner, that is for tuning the many parameters of quality control methods in titanlib and provides a graphical interface for visualizing flagged data.

Features

  • A wide variety of spatial checks, such as spatial consistency test, buddy check, isolation check.
  • Plausability tests such as range check and climatology check.
  • Fast C++ implementation for efficient processing of large observation datasets

Quick-start in python

The easiest is to install the latest release of the package using pip. Provided you have installed the dependencies listed above, you can install the most recent release of the python package as follows:

pip install titanlib

Installation

For full installation instructions, see the following wiki page.

Python example

Here is an example using the buddy check, which has the following function signature:

buddy_check(points, values, radius, num_min, threshold, max_elev_diff, elev_gradient, min_std, num_iterations)

The test reveals that the last observation (-111) is likely faulty:

import titanlib

# Set up some fake data
lats = [60,60.1,60.2]
lons = [10,10,10]
elevs = [0,0,0]
obs = [0, 1, -111]
points = titanlib.Points(lats, lons, elevs)

# Run the buddy check on the data
flags = titanlib.buddy_check(points,
   obs,
   [50000], # radius
   [2],     # num_min
   2,       # threshold
   200,     # max_elev_diff
   0,       # elev_gradient
   1,       # min_std
   2,       # num_iterations
)

print(flags)

>>> [0 0 1]

R example

Run the following code in R from the build directory, or if you want to run from any other directory, just put in the proper paths for rtitanlib and titanlib.R

dyn.load(paste("extras/SWIG/R/titanlib", .Platform$dynlib.ext, sep=""))
source("extras/SWIG/R/titanlib.R")
cacheMetaData(1)

sct(c(60,60.1,60.2), c(10,10,10), c(0,0,0), c(0,1,-111),50000,2,2,100,0,1,2)

See also the Installation tips and tricks on the wiki .

Copyright and license

Copyright © 2019-2022 Norwegian Meteorological Institute. Titanlib is licensed under The GNU Lesser General Public License (LGPL). See LICENSE file.