Gridpp 0.7.0
A post-processing library for gridded weather forecasts
Classes | Namespaces | Macros | Enumerations
gridpp.h File Reference
#include <vector>
#include <string>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/math/distributions/gamma.hpp>
#include <boost/math/distributions/normal.hpp>
#include <exception>

Go to the source code of this file.

Classes

class  gridpp::BarnesStructure
 Simple structure function based on distance, elevation, and land area fraction. More...
 
class  gridpp::BoxCox
 Box-Cox transformation. More...
 
class  gridpp::CressmanStructure
 Simple structure function based on distance, elevation, and land area fraction. More...
 
class  gridpp::CrossValidation
 
class  gridpp::Gamma
 Gamma transformation. More...
 
class  gridpp::Grid
 Represents a 2D grid of locations and their metadata. More...
 
class  gridpp::Identity
 Identity transform, i.e. More...
 
struct  gridpp::KDTree::is_not_equal
 
class  gridpp::KDTree
 Helper class for Grid and Points representing a tree of points. More...
 
class  gridpp::Log
 Log transformation: output = log(input) More...
 
class  gridpp::MultipleStructure
 
class  gridpp::not_implemented_exception
 
class  gridpp::Point
 Represents a single point in some coordinate system. More...
 
class  gridpp::Points
 Represents a vector of locations and their metadata. More...
 
class  gridpp::StructureFunction
 Covariance structure function. More...
 
class  gridpp::Transform
 
struct  gridpp::KDTree::within_radius
 

Namespaces

 gridpp
 

Macros

#define __version__   GRIDPP_VERSION
 
#define GRIDPP_VERSION   "0.7.0"
 

Typedefs

Short-hand notation for vectors of different dimensions sizes

typedef std::vector< float > gridpp::vec
 1D float vector More...
 
typedef std::vector< vec > gridpp::vec2
 2D float vector More...
 
typedef std::vector< vec2 > gridpp::vec3
 3D float vector More...
 
typedef std::vector< int > gridpp::ivec
 1D integer vector More...
 
typedef std::vector< ivec > gridpp::ivec2
 2D integer vector More...
 
typedef std::vector< ivec2 > gridpp::ivec3
 3D integer vector More...
 
typedef std::vector< double > gridpp::dvec
 1D double vector More...
 
typedef std::vector< dvec > gridpp::dvec2
 2D double vector More...
 

Enumerations

enum  gridpp::ComparisonOperator { gridpp::Lt = 0, gridpp::Leq = 10, gridpp::Gt = 20, gridpp::Geq = 30 }
 Types of comparison operators. More...
 
enum  gridpp::CoordinateType { gridpp::Geodetic = 0, gridpp::Cartesian = 1 }
 Types of coordinates for position of points. More...
 
enum  gridpp::CorrectionType { gridpp::Qq = 0, gridpp::Multiplicative = 10, gridpp::Additive = 20 }
 Method for statistical correction. More...
 
enum  gridpp::Downscaler { gridpp::Nearest = 0, gridpp::Bilinear = 1 }
 Types of simple downscaling methods. More...
 
enum  gridpp::Extrapolation {
  gridpp::OneToOne = 0, gridpp::MeanSlope = 10, gridpp::NearestSlope = 20, gridpp::Zero = 30,
  gridpp::Unchanged = 40
}
 Methods for extrapolating outside a curve. More...
 
enum  gridpp::GradientType { gridpp::MinMax = 0, gridpp::LinearRegression = 10 }
 Types of methods to calculate the gradient. More...
 
enum  gridpp::Metric {
  gridpp::Ets = 0, gridpp::Ts = 1, gridpp::Kss = 20, gridpp::Pc = 30,
  gridpp::Bias = 40, gridpp::Hss = 50
}
 Binary verification metrics. More...
 
enum  gridpp::Statistic {
  gridpp::Mean = 0, gridpp::Min = 10, gridpp::Median = 20, gridpp::Max = 30,
  gridpp::Quantile = 40, gridpp::Std = 50, gridpp::Variance = 60, gridpp::Sum = 70,
  gridpp::Count = 80, gridpp::RandomChoice = 90, gridpp::Unknown = -1
}
 Statistical operations to reduce a vector to a scalar. More...
 

Functions

Data assimilation methods

Functions that merge observations with a background field

vec2 gridpp::optimal_interpolation (const Grid &bgrid, const vec2 &background, const Points &obs_points, const vec &obs, const vec &variance_ratios, const vec &background_at_points, const StructureFunction &structure, int max_points, bool allow_extrapolation=true)
 Optimal interpolation for a deterministic gridded field. More...
 
vec gridpp::optimal_interpolation (const Points &bpoints, const vec &background, const Points &obs_points, const vec &obs, const vec &variance_ratios, const vec &background_at_points, const StructureFunction &structure, int max_points, bool allow_extrapolation=true)
 Optimal interpolation for a deterministic vector of points. More...
 
vec2 gridpp::optimal_interpolation_full (const Grid &bgrid, const vec2 &background, const vec2 &bvariance, const Points &obs_points, const vec &obs, const vec &obs_variance, const vec &background_at_points, const vec &bvariance_at_points, const StructureFunction &structure, int max_points, vec2 &analysis_variance, bool allow_extrapolation=true)
 Optimal interpolation for a deterministic gridded field including analysis variance. More...
 
vec gridpp::optimal_interpolation_full (const Points &bpoints, const vec &background, const vec &bvariance, const Points &obs_points, const vec &obs, const vec &obs_variance, const vec &background_at_points, const vec &bvariance_at_points, const StructureFunction &structure, int max_points, vec &analysis_variance, bool allow_extrapolation=true)
 Optimal interpolation for a deterministic vector of points including analysis variance. More...
 
vec3 gridpp::optimal_interpolation_ensi (const Grid &bgrid, const vec3 &background, const Points &obs_points, const vec &obs, const vec &obs_standard_deviations, const vec2 &background_at_points, const StructureFunction &structure, int max_points, bool allow_extrapolation=true)
 Optimal interpolation for an ensemble gridded field See Lussana et al 2019 (DOI: 10.1002/qj.3646) More...
 
vec2 gridpp::optimal_interpolation_ensi (const Points &bpoints, const vec2 &background, const Points &obs_points, const vec &obs, const vec &obs_standard_deviations, const vec2 &background_at_points, const StructureFunction &structure, int max_points, bool allow_extrapolation=true)
 Optimal interpolation for an ensemble point field See Lussana et al 2019 (DOI: 10.1002/qj.3646) More...
 
vec2 gridpp::local_distribution_correction (const Grid &bgrid, const vec2 &background, const Points &obs_points, const vec &obs, const vec &background_at_points, const StructureFunction &structure, float min_quantile, float max_quantile, int min_points=0)
 Correction of a gridded field ensuring the distribution of values nearby match that of observations. More...
 
vec2 gridpp::local_distribution_correction (const Grid &bgrid, const vec2 &background, const Points &obs_points, const vec2 &obs, const vec2 &background_at_points, const StructureFunction &structure, float min_quantile, float max_quantile, int min_points=0)
 Correction of a gridded field ensuring the distribution of values nearby match that of observations. More...
 
vec2 gridpp::fill (const Grid &igrid, const vec2 &input, const Points &points, const vec &radii, float value, bool outside)
 Fill in values inside or outside a set of circles (useful for masking) More...
 
vec2 gridpp::doping_square (const Grid &igrid, const vec2 &background, const Points &points, const vec &observations, const ivec &halfwidths, float max_elev_diff=gridpp::MV)
 Insert observations into gridded field using a square box. More...
 
vec2 gridpp::doping_circle (const Grid &igrid, const vec2 &background, const Points &points, const vec &observations, const vec &radii, float max_elev_diff=gridpp::MV)
 Insert observations into gridded field using a circle. More...
 
Distributions

Functions that extract values from probability distributions

vec gridpp::gamma_inv (const vec &levels, const vec &shape, const vec &scale)
 Extract quantiles from a gamma distribution. More...
 
Spatial neighbourhood filters

Functions that apply neighbourhood filters on a gridded field

vec2 gridpp::neighbourhood (const vec2 &input, int halfwidth, Statistic statistic)
 Spatial neighbourhood filter, computing a statistic for a sliding square window. More...
 
vec2 gridpp::neighbourhood (const vec3 &input, int halfwidth, Statistic statistic)
 Spatial neighbourhood filter for an ensemble of fields. More...
 
vec2 gridpp::neighbourhood_quantile (const vec2 &input, float quantile, int halfwidth)
 Computes a quantile in a sliding square neighbourhood. More...
 
vec2 gridpp::neighbourhood_quantile (const vec3 &input, float quantile, int halfwidth)
 Computes a quantile in a sliding square neighbourhood across ensemble members. More...
 
vec2 gridpp::neighbourhood_quantile_fast (const vec2 &input, float quantile, int halfwidth, const vec &thresholds)
 Fast and approximate neighbourhood quantile. More...
 
vec2 gridpp::neighbourhood_quantile_fast (const vec3 &input, float quantile, int halfwidth, const vec &thresholds)
 Fast and approximate neighbourhood quantile for ensemble of fields. More...
 
vec2 gridpp::neighbourhood_quantile_fast (const vec2 &input, const vec2 &quantile, int halfwidth, const vec &thresholds)
 Fast and approximate neighbourhood quantile, with spatially varying quantile levels. More...
 
vec2 gridpp::neighbourhood_quantile_fast (const vec3 &input, const vec2 &quantile, int halfwidth, const vec &thresholds)
 Fast and approximate neighbourhood quantile for ensemble of fields, with spatially varying quantile. More...
 
vec2 gridpp::neighbourhood_brute_force (const vec2 &input, int halfwidth, Statistic statistic)
 Spatial neighbourhood filter without any shortcuts. More...
 
vec2 gridpp::neighbourhood_brute_force (const vec3 &input, int halfwidth, Statistic statistic)
 Spatial ensemble neighbourhood filter without any shortcuts. More...
 
vec gridpp::get_neighbourhood_thresholds (const vec2 &input, int num_thresholds)
 Calculate appropriate approximation thresholds for fast neighbourhood quantile. More...
 
vec gridpp::get_neighbourhood_thresholds (const vec3 &input, int num_thresholds)
 Calculate appropriate approximation thresholds for neighbourhood quantile based on an ensemble. More...
 
vec2 gridpp::calc_gradient (const vec2 &base, const vec2 &values, GradientType gradient_type, int halfwidth, int min_num=2, float min_range=gridpp::MV, float default_gradient=0)
 Computes gradients based on values in neighbourhood. More...
 
vec2 gridpp::neighbourhood_search (const vec2 &array, const vec2 &search_array, int halfwidth, float search_target_min, float search_target_max, float search_delta, const ivec2 &apply_array=ivec2())
 Find suitable value in neighbourhood that match a search criteria. More...
 
vec2 gridpp::neighbourhood_ens (const vec3 &input, int halfwidth, Statistic statistic)
 Deprecated: Compute neighbourhood statistic on ensemble field. More...
 
vec2 gridpp::neighbourhood_quantile_ens (const vec3 &input, float quantile, int halfwidth)
 Deprecated: Compute neighbourhood quantiles on ensemble field. More...
 
vec2 gridpp::neighbourhood_quantile_ens_fast (const vec3 &input, float quantile, int radius, const vec &thresholds)
 Deprecated: Compute neighbourhood quantiles fast on ensemble field. More...
 
Calibration methods

Functions that apply statistical methods to data

vec gridpp::quantile_mapping_curve (const vec &ref, const vec &fcst, vec &output_fcst, vec quantiles=vec())
 Create quantile mapping calibration curve. More...
 
vec gridpp::metric_optimizer_curve (const vec &ref, const vec &fcst, const vec &thresholds, Metric metric, vec &output_fcst)
 Create calibration curve that optimizes a metric. More...
 
float gridpp::apply_curve (float fcst, const vec &curve_ref, const vec &curve_fcst, Extrapolation policy_below, Extrapolation policy_above)
 Apply arbitrary calibration curve to a single value. More...
 
vec gridpp::apply_curve (const vec &fcst, const vec &curve_ref, const vec &curve_fcst, Extrapolation policy_below, Extrapolation policy_above)
 Apply arbitrary calibration curve to 1D forecasts. More...
 
vec2 gridpp::apply_curve (const vec2 &fcst, const vec &curve_ref, const vec &curve_fcst, Extrapolation policy_below, Extrapolation policy_above)
 Apply arbitrary calibration curve to 2D forecasts. More...
 
vec2 gridpp::apply_curve (const vec2 &fcst, const vec3 &curve_ref, const vec3 &curve_fcst, Extrapolation policy_below, Extrapolation policy_above)
 Apply arbitrary calibration curve to 2D forecasts with spatially varying QQ map. More...
 
vec gridpp::monotonize_curve (vec curve_ref, vec curve_fcst, vec &output_fcst)
 Ensure calibration curve is monotonic, by removing points on the curve. More...
 
float gridpp::get_optimal_threshold (const vec &curve_ref, const vec &curve_fcst, float threshold, Metric metric)
 Compute the optimal threshold to remap an input threshold to. More...
 
float gridpp::calc_score (float a, float b, float c, float d, Metric metric)
 Compute the score for a 2x2 contingency table. More...
 
float gridpp::calc_score (const vec &ref, const vec &fcst, float threshold, Metric metric)
 Compute the score for a 2x2 contingency table by thresholding. More...
 
float gridpp::calc_score (const vec &ref, const vec &fcst, float threshold, float fthreshold, Metric metric)
 Compute the score for a 2x2 contingency table by thresholding and allowing a different threshold for the forecast. More...
 
Downscaling methods

Functions that interpolate data from one grid to another

vec2 gridpp::downscaling (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, Downscaler downscaler)
 Downscale a gridded field. More...
 
vec3 gridpp::downscaling (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues, Downscaler downscaler)
 Downscale a gridded ensemble field. More...
 
vec gridpp::downscaling (const Grid &igrid, const Points &opoints, const vec2 &ivalues, Downscaler downscaler)
 Downscale a gridded field to points. More...
 
vec2 gridpp::downscaling (const Grid &igrid, const Points &opoints, const vec3 &ivalues, Downscaler downscaler)
 Downscale a gridded ensemble field to points. More...
 
vec2 gridpp::nearest (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues)
 Nearest neighbour dowscaling grid to grid for a deterministic field. More...
 
vec3 gridpp::nearest (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues)
 Nearest neighbour dowscaling grid to grid for an ensemble field. More...
 
vec gridpp::nearest (const Grid &igrid, const Points &opoints, const vec2 &ivalues)
 Nearest neighbour dowscaling grid to point for a deterministic field. More...
 
vec2 gridpp::nearest (const Grid &igrid, const Points &opoints, const vec3 &ivalues)
 Nearest neighbour dowscaling grid to point for an ensemble field. More...
 
vec gridpp::nearest (const Points &ipoints, const Points &opoints, const vec &ivalues)
 Nearest neighbour dowscaling point to point for a deterministic field. More...
 
vec2 gridpp::nearest (const Points &ipoints, const Points &opoints, const vec2 &ivalues)
 Nearest neighbour dowscaling point to point for an ensemble field. More...
 
vec2 gridpp::nearest (const Points &ipoints, const Grid &ogrid, const vec &ivalues)
 Nearest neighbour dowscaling point to grid for a deterministic field. More...
 
vec3 gridpp::nearest (const Points &ipoints, const Grid &ogrid, const vec2 &ivalues)
 Nearest neighbour dowscaling point to grid for an ensemble field. More...
 
vec2 gridpp::downscale_probability (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues, const vec2 &threshold, const ComparisonOperator &comparison_operator)
 Nearest neighbour downscaling grid to grid and probability in one. More...
 
vec2 gridpp::mask_threshold_downscale_consensus (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues_true, const vec3 &ivalues_false, const vec3 &theshold_values, const vec2 &threshold, const ComparisonOperator &comparison_operator, const Statistic &statistic)
 Masked ensemble downscaling and consensus. More...
 
vec2 gridpp::mask_threshold_downscale_quantile (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues_true, const vec3 &ivalues_false, const vec3 &theshold_values, const vec2 &threshold, const ComparisonOperator &comparison_operator, const float quantile_level)
 Masked ensemble downscaling and quantile extraction. More...
 
vec2 gridpp::bilinear (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues)
 Bilinear downscaling grid to grid for a deterministic field. More...
 
vec3 gridpp::bilinear (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues)
 Bilinear dowscaling grid to grid for an ensemble field. More...
 
vec gridpp::bilinear (const Grid &igrid, const Points &opoints, const vec2 &ivalues)
 Bilinear dowscaling grid to point for a deterministic field. More...
 
vec2 gridpp::bilinear (const Grid &igrid, const Points &opoints, const vec3 &ivalues)
 Bilinear dowscaling grid to point for an ensemble field. More...
 
vec2 gridpp::simple_gradient (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, float elev_gradient, Downscaler downscaler=Nearest)
 Elevation correction dowscaling grid to grid for a deterministic field. More...
 
vec3 gridpp::simple_gradient (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues, float elev_gradient, Downscaler downscaler=Nearest)
 Elevation correction dowscaling grid to grid for an ensemble field. More...
 
vec gridpp::simple_gradient (const Grid &igrid, const Points &opoints, const vec2 &ivalues, float elev_gradient, Downscaler downscaler=Nearest)
 Elevation correction dowscaling grid to point for a deterministic field. More...
 
vec2 gridpp::simple_gradient (const Grid &igrid, const Points &opoints, const vec3 &ivalues, float elev_gradient, Downscaler downscaler=Nearest)
 Elevation correction dowscaling grid to point for an ensemble field. More...
 
vec2 gridpp::full_gradient (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, const vec2 &elev_gradient, const vec2 &laf_gradient=vec2(), Downscaler downscaler=Nearest)
 Compute Downscale. More...
 
vec3 gridpp::full_gradient (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues, const vec3 &elev_gradient, const vec3 &laf_gradient, Downscaler downscaler=Nearest)
 Spatially varying gradient dowscaling grid to grid for an ensemble field. More...
 
vec gridpp::full_gradient (const Grid &igrid, const Points &opoints, const vec2 &ivalues, const vec2 &elev_gradient, const vec2 &laf_gradient, Downscaler downscaler=Nearest)
 Spatially varying gradient dowscaling grid to point for a deterministic field. More...
 
vec2 gridpp::full_gradient (const Grid &igrid, const Points &opoints, const vec3 &ivalues, const vec3 &elev_gradient, const vec3 &laf_gradient, Downscaler downscaler=Nearest)
 Spatially varying gradient dowscaling grid to point for an ensemble field. More...
 
vec3 gridpp::full_gradient_debug (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, const vec2 &elev_gradient, const vec2 &laf_gradient=vec2(), Downscaler downscaler=Nearest)
 
vec2 gridpp::smart (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, int num, const StructureFunction &structure)
 Smart neighbour downscaling grid to grid for a deterministic field. More...
 
Grid calculations

Functions that calculate statistics on a grid

vec gridpp::count (const Grid &grid, const Points &points, float radius)
 For each point, counts the number of gridpoints within the radius. More...
 
vec2 gridpp::count (const Grid &igrid, const Grid &ogrid, float radius)
 For each gridpoint, counts the number of gridpoints within the radius. More...
 
vec2 gridpp::count (const Points &points, const Grid &grid, float radius)
 For each gridpoint, counts the number of points within the radius. More...
 
vec gridpp::count (const Points &ipoints, const Points &opoints, float radius)
 For each point, counts the number of points within the radius. More...
 
vec gridpp::distance (const Grid &grid, const Points &points, int num=1)
 For each point, calculates the distance to nearest gridpoint. More...
 
vec2 gridpp::distance (const Grid &igrid, const Grid &ogrid, int num=1)
 For each output gridpoint, calculate the distance to nearest input gridpoint. More...
 
vec2 gridpp::distance (const Points &points, const Grid &grid, int num=1)
 For each gridpoint, calculates the distance to nearest point. More...
 
vec gridpp::distance (const Points &ipoints, const Points &opoint, int num=1)
 For each output point, calculates the distance to nearest input point. More...
 
vec2 gridpp::fill_missing (const vec2 &values)
 Fill in missing values based on nearby values. More...
 
vec2 gridpp::gridding (const Grid &grid, const Points &points, const vec &values, float radius, int min_num, Statistic statistic)
 Aggregate points onto a grid. More...
 
vec gridpp::gridding (const Points &opoints, const Points &ipoints, const vec &values, float radius, int min_num, Statistic statistic)
 Aggregate points onto a points. More...
 
vec2 gridpp::gridding_nearest (const Grid &grid, const Points &points, const vec &values, int min_num, gridpp::Statistic statistic)
 Assign each point to nearest neighbour in grid and aggregate values. More...
 
vec gridpp::gridding_nearest (const Points &opoints, const Points &ipoints, const vec &values, int min_num, gridpp::Statistic statistic)
 Assign each ipoint to nearest neighbour in opoints and aggregate values. More...
 
vec2 gridpp::neighbourhood_score (const Grid &grid, const Points &points, const vec2 &fcst, const vec &ref, int half_width, gridpp::Metric metric, float threshold)
 Compute a score for a metric of all points within a radius. More...
 
Diagnosing meteorological variables

Functions that diagnose a meteorological variable based on other variables

float gridpp::dewpoint (float temperature, float relative_humidity)
 Calculate dewpoint temperature from temperature and relative humidity. More...
 
vec gridpp::dewpoint (const vec &temperature, const vec &relative_humidity)
 Vector version of dewpoint calculation. More...
 
float gridpp::pressure (float ielev, float oelev, float ipressure, float itemperature=288.15)
 Calculate pressure at a new elevation. More...
 
vec gridpp::pressure (const vec &ielev, const vec &oelev, const vec &ipressure, const vec &itemperature)
 Calculate Vector version of pressure calculation. More...
 
float gridpp::sea_level_pressure (float ps, float altitude, float temperature, float rh=gridpp::MV, float dewpoint=gridpp::MV)
 Convert Surface Pressure to Sea Level Pressure. More...
 
vec gridpp::sea_level_pressure (const vec &ps, const vec &altitude, const vec &temperature, const vec &rh, const vec &dewpoint)
 Vector version of Convert Surface Pressure to Sea Level Pressure. More...
 
float gridpp::qnh (float pressure, float altitude)
 Diagnose QNH from pressure and altitude. More...
 
vec gridpp::qnh (const vec &pressure, const vec &altitude)
 Vector version of QNH calculation. More...
 
float gridpp::relative_humidity (float temperature, float dewpoint)
 Calculate relative humidity from temperature and dewpoint temperature. More...
 
vec gridpp::relative_humidity (const vec &temperature, const vec &dewpoint)
 Vector version of relative humidity calculation. More...
 
float gridpp::wetbulb (float temperature, float pressure, float relative_humidity)
 Calculate wetbulb temperature from temperature, pressure, and relative humidity. More...
 
vec gridpp::wetbulb (const vec &temperature, const vec &pressure, const vec &relative_humidity)
 Vector version of wetbulb calculation. More...
 
float gridpp::wind_speed (float xwind, float ywind)
 Diagnose wind speed from its components. More...
 
vec gridpp::wind_speed (const vec &xwind, const vec &ywind)
 Vector version of wind speed calculation. More...
 
float gridpp::wind_direction (float xwind, float ywind)
 Diagnose wind direction from its components. More...
 
vec gridpp::wind_direction (const vec &xwind, const vec &ywind)
 Vector version of wind direction calculation. More...
 
OpenMP settings

Functions that configure OpenMP

void gridpp::set_omp_threads (int num)
 Set the number of OpenMP threads to use. More...
 
int gridpp::get_omp_threads ()
 Get the number of OpenMP threads currently set. More...
 
void gridpp::initialize_omp ()
 Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined. More...
 

Variables

Constants

Functions that assimilate observations onto a gridded background

static const float gridpp::MV = NAN
 Missing value indicator. More...
 
static const float gridpp::MV_CML = -999
 Missing value indicator in gridpp command-line tool. More...
 
static const float gridpp::pi = 3.14159265
 Mathematical constant pi. More...
 
static const double gridpp::radius_earth = 6.378137e6
 Radius of the earth [m]. More...
 
static const float gridpp::lapse_rate =0.0065
 Constant Lapse Rate moist air standard atmosphere [K/m]. More...
 
static const float gridpp::standard_surface_temperature = 288.15
 Temperature at surface in standard atmosphere [K]. More...
 
static const float gridpp::gravit = 9.80665
 Gravitational acceleration [m/s^2]. More...
 
static const float gridpp::molar_mass = 0.0289644
 Molar Mass of Dry Air [kg/mol]. More...
 
static const float gridpp::gas_constant_mol = 8.31447
 Universal Gas Constant [kg*m^2*s^-2/(K*mol)]. More...
 
static const float gridpp::gas_constant_si = 287.05
 Universal Gas Constant [J/(kg*K)]. More...
 

Utilities


Helper functions

static int gridpp::_debug_level = 0
 
void gridpp::set_debug_level (int level)
 Set the verbosity of debug messages. More...
 
int gridpp::get_debug_level ()
 Get the currently set level of debug messagess. More...
 
Statistic gridpp::get_statistic (std::string name)
 Convert name of a statistic enums. More...
 
std::string gridpp::version ()
 The gridpp version. More...
 
double gridpp::clock ()
 The current time. More...
 
void gridpp::debug (std::string string)
 Writes a debug message to standard out. More...
 
void gridpp::warning (std::string string)
 Writes a warning message to standard out. More...
 
void gridpp::error (std::string string)
 Writes an error message to standard out. More...
 
void gridpp::future_deprecation_warning (std::string function, std::string other="")
 Writes an deprecation warning to standard out. More...
 
bool gridpp::is_valid (float value)
 Checks if a value is valid. More...
 
float gridpp::calc_statistic (const vec &array, Statistic statistic)
 Compute a statistic on a 1D vector. More...
 
float gridpp::calc_quantile (const vec &array, float quantile_level)
 Compute a quantile from a 1D vector. More...
 
vec gridpp::calc_statistic (const vec2 &array, Statistic statistic)
 Compute a statistic on a 2D vector. More...
 
vec gridpp::calc_quantile (const vec2 &array, float quantile=MV)
 Compute a quantile from a 2D vector. More...
 
vec2 gridpp::calc_quantile (const vec3 &array, const vec2 &quantile_levels)
 Compute quantile with 2D varying quantile level. More...
 
bool gridpp::convert_coordinates (const vec &lats, const vec &lons, CoordinateType type, vec &x_coords, vec &y_coords, vec &z_coords)
 Convert lats/lons or 2D x/y coordinates to 3D cartesian coordinates with the centre of the earth as the origin. More...
 
bool gridpp::convert_coordinates (float lat, float lon, CoordinateType type, float &x_coord, float &y_coord, float &z_coord)
 Convert lat/lon or 2D x/y coordinate to 3D cartesian coordinate with the centre of the earth as the origin. More...
 
bool gridpp::is_valid_lat (float lat, CoordinateType type)
 Checks that a lat-coordinate is valid (based on the coordinate type) More...
 
bool gridpp::is_valid_lon (float lon, CoordinateType type)
 Checks that a lon-coordinate is valid (based on the coordinate type) More...
 
int gridpp::num_missing_values (const vec2 &iArray)
 Count the number of missing values in a vector. More...
 
int gridpp::get_lower_index (float iX, const vec &iValues)
 Find the index in a vector that is equal to or just below a value. More...
 
int gridpp::get_upper_index (float iX, const vec &iValues)
 Find the index in a vector that is equal to or just above a value. More...
 
float gridpp::interpolate (float x, const vec &iX, const vec &iY)
 Piecewise linear interpolation If x is outside the range of iX, then the min/max value of iY is used. More...
 
vec gridpp::interpolate (const vec &x, const vec &iX, const vec &iY)
 Piecewise linear interpolation, vectorised version. More...
 
ivec2 gridpp::init_ivec2 (int Y, int X, int value)
 Initialize a 2D integer vector of size Y, X, with a given value. More...
 
vec2 gridpp::init_vec2 (int Y, int X, float value=MV)
 Initialize a 2D float vector of size Y, X, with a given value. More...
 
ivec3 gridpp::init_ivec3 (int Y, int X, int E, int value)
 Initialize a 3D integer vector of size Y, X, E, with a given value. More...
 
vec3 gridpp::init_vec3 (int Y, int X, int E, float value=MV)
 Initialize a 3D float vector of size Y, X, E, with a given value. More...
 
vec gridpp::calc_even_quantiles (const vec &values, int num)
 Get reasonably spaced quantile levels from a vector of values, ignoring duplicate values but including the first number after duplicated values. More...
 
vec2 gridpp::window (const vec2 &array, int length, gridpp::Statistic statistic, bool before=false, bool keep_missing=false, bool missing_edges=true)
 Compute window statistics across time, independently for each case. More...
 
bool gridpp::compatible_size (const Grid &grid, const vec2 &v)
 Check if the grid is the same size as the 2D vector. More...
 
bool gridpp::compatible_size (const Grid &grid, const vec3 &v)
 Check if the grid is compatible with 3D vector. More...
 
bool gridpp::compatible_size (const Points &points, const vec &v)
 Check if the points are compatible with a 1D vector. More...
 
bool gridpp::compatible_size (const Points &points, const vec2 &v)
 Check if the points are compatible with a 2D vector. More...
 
bool gridpp::compatible_size (const vec2 &a, const vec2 &b)
 Check if two 2D vectors are compatible. More...
 
bool gridpp::compatible_size (const vec2 &a, const vec3 &b)
 Check if a 2D and 3D vectors are compatible. More...
 
bool gridpp::compatible_size (const vec3 &a, const vec3 &b)
 Check if two 3D vectors are compatible. More...
 
bool gridpp::point_in_rectangle (const Point &A, const Point &B, const Point &C, const Point &D, const Point &m)
 Checks if a point is located inside a rectangle formed by 4 points. More...
 

SWIG testing functions


Functions for testing the SWIG interface.

Not useful for any other purpose.

static const float gridpp::swig_default_value = -1
 Default value used to fill array in SWIG testing functions. More...
 
float * gridpp::test_array (float *v, int n)
 Special function whose presense is needed for SWIG. More...
 
float gridpp::test_vec_input (const vec &input)
 Testing function for 1D input vector. More...
 
int gridpp::test_ivec_input (const ivec &input)
 Testing function for 1D input vector. More...
 
float gridpp::test_vec2_input (const vec2 &input)
 Testing function for 2D input vector. More...
 
float gridpp::test_vec3_input (const vec3 &input)
 Testing function for 3D input vector. More...
 
vec gridpp::test_vec_output ()
 Testing function for 1D output vector. More...
 
ivec gridpp::test_ivec_output ()
 
vec2 gridpp::test_vec2_output ()
 Testing function for 2D output vector. More...
 
ivec2 gridpp::test_ivec2_output ()
 
vec3 gridpp::test_vec3_output ()
 Testing function for 3D output vector. More...
 
ivec3 gridpp::test_ivec3_output ()
 
float gridpp::test_vec_argout (vec &distances)
 Testing function for 1D vector treated as output. More...
 
float gridpp::test_vec2_argout (vec2 &distances)
 Testing function for 2D vector treated as output. More...
 
void gridpp::test_not_implemented_exception ()
 

Macro Definition Documentation

◆ __version__

#define __version__   GRIDPP_VERSION

◆ GRIDPP_VERSION

#define GRIDPP_VERSION   "0.7.0"