#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 <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 |
class | gridpp::CressmanStructure |
Simple structure function based on distance, elevation, and land area fraction. More... | |
class | gridpp::CrossValidation |
class | gridpp::Grid |
Represents a 2D grid of locations and their metadata. More... | |
class | gridpp::Identity |
class | gridpp::KDTree |
Helper class for Grid and Points. More... | |
class | gridpp::Log |
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 |
Namespaces | |
gridpp | |
Macros | |
#define | __version__ GRIDPP_VERSION |
#define | GRIDPP_VERSION "0.5.0" |
Typedefs | |
Short-hand notation for vectors of different dimensions sizes | |
typedef std::vector< float > | gridpp::vec |
typedef std::vector< vec > | gridpp::vec2 |
typedef std::vector< vec2 > | gridpp::vec3 |
typedef std::vector< int > | gridpp::ivec |
typedef std::vector< ivec > | gridpp::ivec2 |
typedef std::vector< ivec2 > | gridpp::ivec3 |
typedef std::vector< double > | gridpp::dvec |
typedef std::vector< dvec > | gridpp::dvec2 |
Enumerations | |
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::Extrapolation { gridpp::OneToOne = 0, gridpp::MeanSlope = 10, gridpp::NearestSlope = 20, gridpp::Zero = 30 } |
Methods for extrapolating outside a curve. 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::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 &points, const vec &pobs, const vec &pratios, const vec &pbackground, const StructureFunction &structure, int max_points) |
Optimal interpolation for a deterministic gridded field. More... | |
vec | gridpp::optimal_interpolation (const Points &bpoints, const vec &background, const Points &points, const vec &pobs, const vec &pratios, const vec &pbackground, const StructureFunction &structure, int max_points) |
Optimal interpolation for a deterministic vector of points. More... | |
vec2 | gridpp::optimal_interpolation_transform (const Grid &bgrid, const vec2 &background, float bsigma, const Points &points, const vec &pobs, const vec &psigmas, const vec &pbackground, const StructureFunction &structure, int max_points, const Transform &transform) |
This is its own function because the variance parameterization is different than in the non-transformed case. More... | |
vec | gridpp::optimal_interpolation_transform (const Points &bpoints, const vec &background, float bsigma, const Points &points, const vec &pobs, const vec &psigmas, const vec &pbackground, const StructureFunction &structure, int max_points, const Transform &transform) |
vec3 | gridpp::optimal_interpolation_ensi (const Grid &bgrid, const vec3 &background, const Points &points, const vec &pobs, const vec &psigmas, const vec2 &pbackground, const StructureFunction &structure, int max_points) |
Optimal interpolation using a structure function based on an ensemble See Lussana et al 2019 (DOI: 10.1002/qj.3646) More... | |
vec2 | gridpp::optimal_interpolation_ensi (const Points &bpoints, const vec2 &background, const Points &points, const vec &pobs, const vec &psigmas, const vec2 &pbackground, const StructureFunction &structure, int max_points) |
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. 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 for an ensemble of fields. 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. 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 neighbourhood filter without any shortcuts. More... | |
vec | gridpp::get_neighbourhood_thresholds (const vec2 &input, int num_thresholds) |
Calculate appropriate approximation thresholds for 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::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 | |
vec2 | gridpp::quantile_mapping_curve (const vec &ref, const vec &fcst, vec quantiles=vec()) |
Create quantile mapping calibration curve. More... | |
vec2 | gridpp::metric_optimizer_curve (const vec &ref, const vec &fcst, const vec &thresholds, Metric metric) |
Create calibration curve that optimizes a metric. More... | |
vec | gridpp::apply_curve (const vec &fcst, const vec2 &curve, Extrapolation policy_below, Extrapolation policy_above) |
Apply arbitrary calibration curve to 1D forecasts. More... | |
vec2 | gridpp::apply_curve (const vec2 &fcst, const vec2 &curve, Extrapolation policy_below, Extrapolation policy_above) |
Apply arbitrary calibration curve to 2D forecasts. More... | |
vec2 | gridpp::monotonize_curve (vec2 curve) |
Ensure calibration curve is monotonic, by removing points. More... | |
float | gridpp::get_optimal_threshold (const vec &ref, const vec &fcst, float threshold, Metric metric) |
float | gridpp::calc_score (float a, float b, float c, float d, Metric metric) |
float | gridpp::calc_score (const vec &ref, const vec &fcst, float threshold, Metric metric) |
float | gridpp::calc_score (const vec &ref, const vec &fcst, float threshold, float fthreshold, Metric metric) |
vec2 | gridpp::correction (const Grid &rgrid, const vec2 &rvalues, const Points &npoints, const vec &nvalues, float mean_radius, float outer_radius, float inner_radius, int min_num, int max_num, CorrectionType type, ivec2 &count) |
vec2 | gridpp::correction (const Grid &rgrid, const vec3 &rvalues, const Points &npoints, const vec2 &nvalues, const vec2 &apply_values, float mean_radius, float outer_radius, float inner_radius, int min_num, int max_num, CorrectionType type, ivec2 &count) |
Downscaling methods | |
Functions that interpolate data from one grid to another | |
vec2 | gridpp::nearest (const Grid &igrid, const Grid &ogrid, const vec2 ivalues) |
Nearest neighbour dowscaling grid to grid. More... | |
vec3 | gridpp::nearest (const Grid &igrid, const Grid &ogrid, const vec3 ivalues) |
vec | gridpp::nearest (const Grid &igrid, const Points &opoints, const vec2 ivalues) |
Nearest neighbour dowscaling grid to point. More... | |
vec2 | gridpp::nearest (const Grid &igrid, const Points &opoints, const vec3 ivalues) |
vec2 | gridpp::bilinear (const Grid &igrid, const Grid &ogrid, const vec2 ivalues) |
Bilinear downscaling grid to grid. More... | |
vec | gridpp::bilinear (const Grid &igrid, const Points &opoints, const vec2 ivalues) |
Bilinear downscaling grid to points. More... | |
vec2 | gridpp::simple_gradient (const Grid &igrid, const Grid &ogrid, const vec2 ivalues, float elev_gradient) |
vec | gridpp::simple_gradient (const Grid &igrid, const Points &opoints, const vec2 ivalues, float elev_gradient) |
vec2 | gridpp::smart (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, int num, const StructureFunction &structure) |
Smart neighbour downscaling grid to grid. 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 Points &points, const Grid &grid, float radius) |
For each gridpoint, 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... | |
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... | |
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::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... | |
void | gridpp::initialize_omp () |
Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined. More... | |
Utilities | |
Helper functions | |
Statistic | gridpp::get_statistic (std::string name) |
Convert name of a statistic enum. More... | |
std::string | gridpp::version () |
The gridpp version. More... | |
double | gridpp::clock () |
void | gridpp::debug (std::string string) |
void | gridpp::warning (std::string string) |
void | gridpp::error (std::string string) |
void | gridpp::future_deprecation_warning (std::string function, std::string other="") |
bool | gridpp::is_valid (float value) |
float | gridpp::calc_statistic (const vec &array, Statistic statistic) |
float | gridpp::calc_quantile (const vec &array, float quantile) |
vec | gridpp::calc_statistic (const vec2 &array, Statistic statistic) |
vec | gridpp::calc_quantile (const vec2 &array, float quantile=MV) |
int | gridpp::num_missing_values (const vec2 &iArray) |
int | gridpp::get_lower_index (float iX, const std::vector< float > &iValues) |
Find the index in a vector that is equal or just below a value. More... | |
int | gridpp::get_upper_index (float iX, const std::vector< float > &iValues) |
Find the index in a vector that is equal or just above a value. More... | |
float | gridpp::interpolate (float x, const std::vector< float > &iX, const std::vector< float > &iY) |
Piecewise linear interpolation If x is outside the range of iX, then the min/max value of iY is used. More... | |
ivec2 | gridpp::init_ivec2 (int Y, int X, int value) |
Initialize a vector of size Y, X, with a given value. More... | |
vec2 | gridpp::init_vec2 (int Y, int X, float value=MV) |
ivec3 | gridpp::init_ivec3 (int Y, int X, int E, int value) |
Initialize a vector of size Y, X, E, with a given value. More... | |
vec3 | gridpp::init_vec3 (int Y, int X, int E, float value=MV) |
vec | gridpp::calc_even_quantiles (const vec &values, int num) |
Get reasonably spaced quantiles from a vector of values, ignoring duplicate values but including the first number after duplicated values. More... | |
vec2 | gridpp::calc_gradient (const Grid &grid, const vec2 &base, const vec2 &values, int radius, int min_num=2, float min_range=0, float default_gradient=0) |
Computes gradients based on values in neighbourhood. 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) |
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... | |
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... | |
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 () |
#define __version__ GRIDPP_VERSION |
#define GRIDPP_VERSION "0.5.0" |