Typedefs | |
Short-hand notation for vectors of different dimensions sizes | |
typedef std::vector< float > | vec |
typedef std::vector< vec > | vec2 |
typedef std::vector< vec2 > | vec3 |
typedef std::vector< int > | ivec |
typedef std::vector< ivec > | ivec2 |
typedef std::vector< ivec2 > | ivec3 |
typedef std::vector< double > | dvec |
typedef std::vector< dvec > | dvec2 |
Functions | |
Data assimilation methods | |
Functions that merge observations with a background field | |
vec2 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | neighbourhood (const vec2 &input, int halfwidth, Statistic statistic) |
Spatial neighbourhood filter, computing a statistic for a sliding square window. More... | |
vec2 | neighbourhood (const vec3 &input, int halfwidth, Statistic statistic) |
Spatial neighbourhood filter for an ensemble of fields. More... | |
vec2 | neighbourhood_quantile (const vec2 &input, float quantile, int halfwidth) |
Computes a quantile in a sliding square neighbourhood. More... | |
vec2 | neighbourhood_quantile (const vec3 &input, float quantile, int halfwidth) |
Computes a quantile in a sliding square neighbourhood for an ensemble of fields. More... | |
vec2 | neighbourhood_quantile_fast (const vec2 &input, float quantile, int halfwidth, const vec &thresholds) |
Fast and approximate neighbourhood quantile. More... | |
vec2 | neighbourhood_quantile_fast (const vec3 &input, float quantile, int halfwidth, const vec &thresholds) |
Fast and approximate neighbourhood quantile for ensemble of fields. More... | |
vec2 | 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 | 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 | neighbourhood_brute_force (const vec2 &input, int halfwidth, Statistic statistic) |
Spatial neighbourhood filter without any shortcuts. More... | |
vec2 | neighbourhood_brute_force (const vec3 &input, int halfwidth, Statistic statistic) |
Spatial neighbourhood filter without any shortcuts. More... | |
vec | get_neighbourhood_thresholds (const vec2 &input, int num_thresholds) |
Calculate appropriate approximation thresholds for neighbourhood quantile. More... | |
vec | get_neighbourhood_thresholds (const vec3 &input, int num_thresholds) |
Calculate appropriate approximation thresholds for neighbourhood quantile based on an * ensemble. More... | |
vec2 | neighbourhood_ens (const vec3 &input, int halfwidth, Statistic statistic) |
Deprecated: Compute neighbourhood statistic on ensemble field. More... | |
vec2 | neighbourhood_quantile_ens (const vec3 &input, float quantile, int halfwidth) |
Deprecated: Compute neighbourhood quantiles on ensemble field. More... | |
vec2 | 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 | quantile_mapping_curve (const vec &ref, const vec &fcst, vec quantiles=vec()) |
Create quantile mapping calibration curve. More... | |
vec2 | metric_optimizer_curve (const vec &ref, const vec &fcst, const vec &thresholds, Metric metric) |
Create calibration curve that optimizes a metric. More... | |
vec | apply_curve (const vec &fcst, const vec2 &curve, Extrapolation policy_below, Extrapolation policy_above) |
Apply arbitrary calibration curve to 1D forecasts. More... | |
vec2 | apply_curve (const vec2 &fcst, const vec2 &curve, Extrapolation policy_below, Extrapolation policy_above) |
Apply arbitrary calibration curve to 2D forecasts. More... | |
vec2 | monotonize_curve (vec2 curve) |
Ensure calibration curve is monotonic, by removing points. More... | |
float | get_optimal_threshold (const vec &ref, const vec &fcst, float threshold, Metric metric) |
float | calc_score (float a, float b, float c, float d, Metric metric) |
float | calc_score (const vec &ref, const vec &fcst, float threshold, Metric metric) |
float | calc_score (const vec &ref, const vec &fcst, float threshold, float fthreshold, Metric metric) |
vec2 | 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 | 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 | nearest (const Grid &igrid, const Grid &ogrid, const vec2 ivalues) |
Nearest neighbour dowscaling grid to grid. More... | |
vec3 | nearest (const Grid &igrid, const Grid &ogrid, const vec3 ivalues) |
vec | nearest (const Grid &igrid, const Points &opoints, const vec2 ivalues) |
Nearest neighbour dowscaling grid to point. More... | |
vec2 | nearest (const Grid &igrid, const Points &opoints, const vec3 ivalues) |
vec2 | bilinear (const Grid &igrid, const Grid &ogrid, const vec2 ivalues) |
Bilinear downscaling grid to grid. More... | |
vec | bilinear (const Grid &igrid, const Points &opoints, const vec2 ivalues) |
Bilinear downscaling grid to points. More... | |
vec2 | simple_gradient (const Grid &igrid, const Grid &ogrid, const vec2 ivalues, float elev_gradient) |
vec | simple_gradient (const Grid &igrid, const Points &opoints, const vec2 ivalues, float elev_gradient) |
vec2 | 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 | count (const Grid &grid, const Points &points, float radius) |
For each point, counts the number of gridpoints within the radius. More... | |
vec2 | count (const Points &points, const Grid &grid, float radius) |
For each gridpoint, counts the number of points within the radius. More... | |
vec | distance (const Grid &grid, const Points &points, int num=1) |
For each point, calculates the distance to nearest gridpoint. More... | |
vec2 | distance (const Grid &igrid, const Grid &ogrid, int num=1) |
For each output gridpoint, calculate the distance to nearest input gridpoint. More... | |
vec2 | distance (const Points &points, const Grid &grid, int num=1) |
For each gridpoint, calculates the distance to nearest point. More... | |
vec2 | fill_missing (const vec2 &values) |
Fill in missing values based on nearby values. More... | |
vec2 | 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 | dewpoint (float temperature, float relative_humidity) |
Calculate dewpoint temperature from temperature and relative humidity. More... | |
vec | dewpoint (const vec &temperature, const vec &relative_humidity) |
Vector version of dewpoint calculation. More... | |
float | pressure (float ielev, float oelev, float ipressure, float itemperature=288.15) |
Calculate pressure at a new elevation. More... | |
vec | pressure (const vec &ielev, const vec &oelev, const vec &ipressure, const vec &itemperature) |
Calculate Vector version of pressure calculation. More... | |
float | qnh (float pressure, float altitude) |
Diagnose QNH from pressure and altitude. More... | |
vec | qnh (const vec &pressure, const vec &altitude) |
Vector version of QNH calculation. More... | |
float | relative_humidity (float temperature, float dewpoint) |
Calculate relative humidity from temperature and dewpoint temperature. More... | |
vec | relative_humidity (const vec &temperature, const vec &dewpoint) |
Vector version of relative humidity calculation. More... | |
float | wetbulb (float temperature, float pressure, float relative_humidity) |
Calculate wetbulb temperature from temperature, pressure, and relative humidity. More... | |
vec | wetbulb (const vec &temperature, const vec &pressure, const vec &relative_humidity) |
Vector version of wetbulb calculation. More... | |
float | wind_speed (float xwind, float ywind) |
Diagnose wind speed from its components. More... | |
vec | wind_speed (const vec &xwind, const vec &ywind) |
Vector version of wind speed calculation. More... | |
float | wind_direction (float xwind, float ywind) |
Diagnose wind direction from its components. More... | |
vec | wind_direction (const vec &xwind, const vec &ywind) |
Vector version of wind direction calculation. More... | |
OpenMP settings | |
Functions that configure OpenMP | |
void | set_omp_threads (int num) |
Set the number of OpenMP threads to use. More... | |
void | initialize_omp () |
Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined. More... | |
Utilities | |
Helper functions | |
Statistic | get_statistic (std::string name) |
Convert name of a statistic enum. More... | |
std::string | version () |
The gridpp version. More... | |
double | clock () |
void | debug (std::string string) |
void | warning (std::string string) |
void | error (std::string string) |
void | future_deprecation_warning (std::string function, std::string other="") |
bool | is_valid (float value) |
float | calc_statistic (const vec &array, Statistic statistic) |
float | calc_quantile (const vec &array, float quantile) |
vec | calc_statistic (const vec2 &array, Statistic statistic) |
vec | calc_quantile (const vec2 &array, float quantile=MV) |
int | num_missing_values (const vec2 &iArray) |
int | 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 | 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 | 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 | init_ivec2 (int Y, int X, int value) |
Initialize a vector of size Y, X, with a given value. More... | |
vec2 | init_vec2 (int Y, int X, float value=MV) |
ivec3 | init_ivec3 (int Y, int X, int E, int value) |
Initialize a vector of size Y, X, E, with a given value. More... | |
vec3 | init_vec3 (int Y, int X, int E, float value=MV) |
vec | 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 | 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 | compatible_size (const Grid &grid, const vec2 &v) |
Check if the grid is the same size as the 2D vector. More... | |
bool | compatible_size (const Grid &grid, const vec3 &v) |
bool | 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 | MV = NAN |
Missing value indicator. More... | |
static const float | MV_CML = -999 |
Missing value indicator in gridpp command-line tool. More... | |
static const float | pi = 3.14159265 |
Mathematical constant pi. More... | |
static const double | radius_earth = 6.378137e6 |
Radius of the earth [m]. More... | |
Enumerations | |
enum | CoordinateType { Geodetic = 0, Cartesian = 1 } |
Types of coordinates for position of points. More... | |
enum | CorrectionType { Qq = 0, Multiplicative = 10, Additive = 20 } |
Method for statistical correction. More... | |
enum | Extrapolation { OneToOne = 0, MeanSlope = 10, NearestSlope = 20, Zero = 30 } |
Methods for extrapolating outside a curve. More... | |
enum | Metric { Ets = 0, Ts = 1, Kss = 20, Pc = 30, Bias = 40, Hss = 50 } |
Binary verification metrics. More... | |
enum | Statistic { Mean = 0, Min = 10, Median = 20, Max = 30, Quantile = 40, Std = 50, Variance = 60, Sum = 70, Unknown = -1 } |
Statistical operations to reduce a vector to a scalar. More... | |
Classes | |
class | BarnesStructure |
Simple structure function based on distance, elevation, and land area fraction. More... | |
class | BoxCox |
class | CressmanStructure |
Simple structure function based on distance, elevation, and land area fraction. More... | |
class | CrossValidation |
class | Grid |
Represents a 2D grid of locations and their metadata. More... | |
class | Identity |
class | KDTree |
Helper class for Grid and Points. More... | |
class | Log |
class | not_implemented_exception |
class | Point |
Represents a single point in some coordinate system. More... | |
class | Points |
Represents a vector of locations and their metadata. More... | |
class | StructureFunction |
Covariance structure function. More... | |
class | Transform |
SWIG testing functions | |
Functions for testing the SWIG interface. Not useful for any other purpose. | |
static const float | swig_default_value = -1 |
Default value used to fill array in SWIG testing functions. More... | |
float * | test_array (float *v, int n) |
Special function whose presense is needed for SWIG. More... | |
float | test_vec_input (const vec &input) |
Testing function for 1D input vector. More... | |
int | test_ivec_input (const ivec &input) |
Testing function for 1D input vector. More... | |
float | test_vec2_input (const vec2 &input) |
Testing function for 2D input vector. More... | |
float | test_vec3_input (const vec3 &input) |
Testing function for 3D input vector. More... | |
vec | test_vec_output () |
Testing function for 1D output vector. More... | |
ivec | test_ivec_output () |
vec2 | test_vec2_output () |
Testing function for 2D output vector. More... | |
ivec2 | test_ivec2_output () |
vec3 | test_vec3_output () |
Testing function for 3D output vector. More... | |
ivec3 | test_ivec3_output () |
float | test_vec_argout (vec &distances) |
Testing function for 1D vector treated as output. More... | |
float | test_vec2_argout (vec2 &distances) |
Testing function for 2D vector treated as output. More... | |
void | test_not_implemented_exception () |
typedef std::vector<double> gridpp::dvec |
typedef std::vector<dvec> gridpp::dvec2 |
typedef std::vector<int> gridpp::ivec |
typedef std::vector<ivec> gridpp::ivec2 |
typedef std::vector<ivec2> gridpp::ivec3 |
typedef std::vector<float> gridpp::vec |
typedef std::vector<vec> gridpp::vec2 |
typedef std::vector<vec2> gridpp::vec3 |
Methods for extrapolating outside a curve.
enum gridpp::Metric |
enum gridpp::Statistic |
Statistical operations to reduce a vector to a scalar.
vec gridpp::apply_curve | ( | const vec & | fcst, |
const vec2 & | curve, | ||
gridpp::Extrapolation | policy_below, | ||
gridpp::Extrapolation | policy_above | ||
) |
Apply arbitrary calibration curve to 1D forecasts.
fcst | 1D vector of forecast values |
curve | Calibration curve |
policy_below | Extrapolation policy below curve |
policy_above | Extrapolation policy above curve |
vec2 gridpp::apply_curve | ( | const vec2 & | fcst, |
const vec2 & | curve, | ||
gridpp::Extrapolation | policy_below, | ||
gridpp::Extrapolation | policy_above | ||
) |
Apply arbitrary calibration curve to 2D forecasts.
fcst | 2D grid of forecast values |
curve | Calibration curve |
policy_below | Extrapolation policy below curve |
policy_above | Extrapolation policy above curve |
Bilinear downscaling grid to grid.
igrid | Input grid |
ogrid | Output grid to downscale to |
ivalues | 2D vector of values on the input grid |
Bilinear downscaling grid to points.
igrid | Input grid |
ogrid | Output points to downscale to |
ivalues | 2D vector of values on the input grid |
Get reasonably spaced quantiles from a vector of values, ignoring duplicate values but including the first number after duplicated values.
Include the lowest and highest values.
values | vector of values (unsorted, and no invalid values) |
num | number of thresholds to get |
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.
grid | Grid |
base | Dependent variable. Missing values are not used. |
values | Independent variable. Missing values are not used. |
radius | Neighbourhood radius in number of gridpoints |
min_nim | Minimum number of points required to compute gradient |
min_range | Minimum range of base to compute gradient |
default_gradient | Use this gradient if minimum number is not met |
float gridpp::calc_quantile | ( | const vec & | array, |
float | quantile | ||
) |
float gridpp::calc_score | ( | float | a, |
float | b, | ||
float | c, | ||
float | d, | ||
gridpp::Metric | metric | ||
) |
float gridpp::calc_score | ( | const vec & | ref, |
const vec & | fcst, | ||
float | threshold, | ||
gridpp::Metric | metric | ||
) |
float gridpp::calc_score | ( | const vec & | ref, |
const vec & | fcst, | ||
float | threshold, | ||
float | fthreshold, | ||
gridpp::Metric | metric | ||
) |
float gridpp::calc_statistic | ( | const vec & | array, |
gridpp::Statistic | statistic | ||
) |
vec gridpp::calc_statistic | ( | const vec2 & | array, |
gridpp::Statistic | statistic | ||
) |
double gridpp::clock | ( | ) |
Check if the grid is the same size as the 2D vector.
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, | ||
gridpp::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, | ||
gridpp::CorrectionType | type, | ||
ivec2 & | count | ||
) |
void gridpp::debug | ( | std::string | string | ) |
float gridpp::dewpoint | ( | float | temperature, |
float | relative_humidity | ||
) |
Calculate dewpoint temperature from temperature and relative humidity.
temperature | Temperature [K] |
relative_humidity | Relative humidity [1] |
Vector version of dewpoint calculation.
temperature | Temperatures [K] |
relative_humidity | Relative humidities [1] |
For each output gridpoint, calculate the distance to nearest input gridpoint.
grid | Grid |
ogrid | Output grid |
num | Number of points |
void gridpp::error | ( | std::string | string | ) |
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.
input | Deterministic values with dimensions Y, X |
radii | Circle radii for each point |
value | Fill in this value |
outside | if True, fill outside circles, if False, fill inside circles |
Fill in missing values based on nearby values.
values | 2D array of values |
void gridpp::future_deprecation_warning | ( | std::string | function, |
std::string | other = "" |
||
) |
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.
iX | Lookup value |
iValues | Lookup vector. Must be sorted. |
Calculate appropriate approximation thresholds for neighbourhood quantile.
input | 2D (Y, X) array of values |
num_thresholds | Number of thresholds |
Calculate appropriate approximation thresholds for neighbourhood quantile based on an * ensemble.
input | 3D (Y, X, T) array of values |
num_thresholds | Number of thresholds |
float gridpp::get_optimal_threshold | ( | const vec & | ref, |
const vec & | fcst, | ||
float | threshold, | ||
gridpp::Metric | metric | ||
) |
gridpp::Statistic gridpp::get_statistic | ( | std::string | name | ) |
Convert name of a statistic enum.
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.
iX | Lookup value |
iValues | Lookup vector. Must be sorted. |
vec2 gridpp::gridding | ( | const Grid & | grid, |
const Points & | points, | ||
const vec & | values, | ||
float | radius, | ||
int | min_num, | ||
gridpp::Statistic | statistic | ||
) |
Aggregate points onto a grid.
Writes MV where there are not enough observations
ivec2 gridpp::init_ivec2 | ( | int | Y, |
int | X, | ||
int | value | ||
) |
Initialize a vector of size Y, X, with a given value.
ivec3 gridpp::init_ivec3 | ( | int | Y, |
int | X, | ||
int | E, | ||
int | value | ||
) |
Initialize a vector of size Y, X, E, with a given value.
void gridpp::initialize_omp | ( | ) |
Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined.
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.
x | Interpolation to this point |
iX | Vector of x-axis values. Vector must be sorted. |
iY | Vector of y-axis values corresponding to iX. |
bool gridpp::is_valid | ( | float | value | ) |
vec2 gridpp::metric_optimizer_curve | ( | const vec & | ref, |
const vec & | fcst, | ||
const vec & | thresholds, | ||
gridpp::Metric | metric | ||
) |
Create calibration curve that optimizes a metric.
ref | Reference values (observations) |
fcst | Forecast values |
thresholds | Thresholds for computing optimal values for |
metric | A Metric to optimize for |
Ensure calibration curve is monotonic, by removing points.
curve | Calibration curve |
Nearest neighbour dowscaling grid to grid.
igrid | Input grid |
ogrid | Output grid to downscale to |
ivalues | 2D vector of values on the input grid |
Nearest neighbour dowscaling grid to point.
igrid | Input grid |
ogrid | Output points to downscale to |
ivalues | 2D vector of values on the input grid |
vec2 gridpp::neighbourhood | ( | const vec2 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter, computing a statistic for a sliding square window.
input | 2D grid of values |
halfwidth | Filter halfwidth in number of gridpoints |
statistic | Statistic to compute |
vec2 gridpp::neighbourhood | ( | const vec3 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter for an ensemble of fields.
input | 3D grid of values with dimensions (Y, X, E) |
halfwidth | Filter halfwidth in number of gridpoints |
statistic | Statistic to compute |
vec2 gridpp::neighbourhood_brute_force | ( | const vec2 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter without any shortcuts.
This is quite slow and is only useful for testing.
input | 2D grid of values |
halfwidth | Filter halfwidth in number of gridpoints |
operation | one of min, mean, median, max |
vec2 gridpp::neighbourhood_brute_force | ( | const vec3 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter without any shortcuts.
This is quite slow and is only useful for testing.
input | 3D grid of values with dimensions (Y, X, E) |
halfwidth | Filter halfwidth in number of gridpoints |
operation | one of min, mean, median, max |
vec2 gridpp::neighbourhood_ens | ( | const vec3 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Deprecated: Compute neighbourhood statistic on ensemble field.
Computes a quantile in a sliding square neighbourhood.
input | 2D grid of values |
quantile | Quantile to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
Computes a quantile in a sliding square neighbourhood for an ensemble of fields.
input | 3D grid of values with dimensions (Y, X, E) |
quantile | Quantile to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
Deprecated: Compute neighbourhood quantiles on ensemble field.
vec2 gridpp::neighbourhood_quantile_ens_fast | ( | const vec3 & | input, |
float | quantile, | ||
int | radius, | ||
const vec & | thresholds | ||
) |
Deprecated: Compute neighbourhood quantiles fast on ensemble field.
vec2 gridpp::neighbourhood_quantile_fast | ( | const vec2 & | input, |
float | quantile, | ||
int | halfwidth, | ||
const vec & | thresholds | ||
) |
Fast and approximate neighbourhood quantile.
input | 2D grid of values |
quantile | Quantile to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | Vector of thresholds to use to approximate value |
vec2 gridpp::neighbourhood_quantile_fast | ( | const vec3 & | input, |
float | quantile, | ||
int | halfwidth, | ||
const vec & | thresholds | ||
) |
Fast and approximate neighbourhood quantile for ensemble of fields.
input | 3D grid of values with dimensions (Y, X, E) |
quantile | Quantile to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | Vector of thresholds to use to approximate value |
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.
input | 2D grid of values |
quantile | 2D grid quantiles to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | Vector of thresholds to use to approximate value |
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.
input | 3D grid of values with dimensions (Y, X, E) |
quantile | 2D grid quantiles to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | Vector of thresholds to use to approximate value |
int gridpp::num_missing_values | ( | const vec2 & | iArray | ) |
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.
bgrid | Grid of background field |
background | 2D field of background values |
points | Points of observations |
pobs | Vector of observations |
pratios | Vector of ratio of observation error variance to background variance |
pbackground | Background with observation operator |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
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.
bpoints | Points of background field |
background | 1D field of background values |
points | Points of observations |
pobs | Vector of observations |
pratios | Vector of ratio of observation error variance to background variance |
pbackground | Background with observation operator |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
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)
input | 3D field of background values (Y, X, E) |
bgrid | grid corresponding to input |
pobs | vector of observations |
pci | vector of ci values |
points | observation points |
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::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.
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 | ||
) |
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.
The 4 points must be provided in an order that draws out a rectangle (either clockwise or counter-clockwise)
A | A point in the rectangle |
B | A point in the rectangle |
C | A point in the rectangle |
D | A point in the rectangle |
m | The point to test if it is inside |
float gridpp::pressure | ( | float | ielev, |
float | oelev, | ||
float | ipressure, | ||
float | itemperature = 288.15 |
||
) |
Calculate pressure at a new elevation.
ielev | Elevation at start point |
oelev | Elevation at new point |
ipressure | Pressure at start point |
itemperature | Temperature at start point |
vec gridpp::pressure | ( | const vec & | ielev, |
const vec & | oelev, | ||
const vec & | ipressure, | ||
const vec & | itemperature | ||
) |
Calculate Vector version of pressure calculation.
ielev | Elevations at start point |
oelev | Elevations at new point |
ipressure | Pressures at start point |
itemperature | Temperatures at start point |
float gridpp::qnh | ( | float | pressure, |
float | altitude | ||
) |
Diagnose QNH from pressure and altitude.
pressure | Pressure at point [pa] |
altitude | Altitude of point [m] |
Vector version of QNH calculation.
pressure | Pressures at points [pa] |
altitude | Altitudes of points [m] |
Create quantile mapping calibration curve.
ref | Reference values (observations) |
fcst | Forecast values |
quantiles | Vector of quantiles to extract. If empty, use all values. |
float gridpp::relative_humidity | ( | float | temperature, |
float | dewpoint | ||
) |
Calculate relative humidity from temperature and dewpoint temperature.
temperature | Temperature [K] |
dewpoint | Dewpoint temperature [K] |
Vector version of relative humidity calculation.
temperature | Temperatures [K] |
dewpoint | Dewpoint temperatures [K] |
void gridpp::set_omp_threads | ( | int | num | ) |
Set the number of OpenMP threads to use.
Overwrides OMP_NUM_THREAD env variable.
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.
igrid | Input grid |
ogrid | Output points to downscale to |
ivalues | 2D vector of values on the input grid |
num | Number of neighbours to average |
structure | Structure function for determining similarity |
float * gridpp::test_array | ( | float * | v, |
int | n | ||
) |
Special function whose presense is needed for SWIG.
ivec2 gridpp::test_ivec2_output | ( | ) |
ivec3 gridpp::test_ivec3_output | ( | ) |
int gridpp::test_ivec_input | ( | const ivec & | input | ) |
Testing function for 1D input vector.
ivec gridpp::test_ivec_output | ( | ) |
void gridpp::test_not_implemented_exception | ( | ) |
float gridpp::test_vec2_argout | ( | vec2 & | distances | ) |
Testing function for 2D vector treated as output.
float gridpp::test_vec2_input | ( | const vec2 & | input | ) |
Testing function for 2D input vector.
vec2 gridpp::test_vec2_output | ( | ) |
Testing function for 2D output vector.
float gridpp::test_vec3_input | ( | const vec3 & | input | ) |
Testing function for 3D input vector.
vec3 gridpp::test_vec3_output | ( | ) |
Testing function for 3D output vector.
float gridpp::test_vec_argout | ( | vec & | distances | ) |
Testing function for 1D vector treated as output.
float gridpp::test_vec_input | ( | const vec & | input | ) |
Testing function for 1D input vector.
vec gridpp::test_vec_output | ( | ) |
Testing function for 1D output vector.
std::string gridpp::version | ( | ) |
The gridpp version.
void gridpp::warning | ( | std::string | string | ) |
float gridpp::wetbulb | ( | float | temperature, |
float | pressure, | ||
float | relative_humidity | ||
) |
Calculate wetbulb temperature from temperature, pressure, and relative humidity.
temperature | Temperature [K] |
pressure | Air pressure [pa] |
Relative | humidity [1] |
vec gridpp::wetbulb | ( | const vec & | temperature, |
const vec & | pressure, | ||
const vec & | relative_humidity | ||
) |
Vector version of wetbulb calculation.
temperature | Temperatures [K] |
pressure | Air pressures [pa] |
Relative | humidities [1] |
float gridpp::wind_direction | ( | float | xwind, |
float | ywind | ||
) |
Diagnose wind direction from its components.
If both xwind and ywind are 0, then direction is 180
xwind | X-component of wind [any unit] |
ywind | Y-component of wind [any unit] |
Vector version of wind direction calculation.
xwind | X-components of wind [any unit] |
ywind | Y-components of wind [any unit] |
float gridpp::wind_speed | ( | float | xwind, |
float | ywind | ||
) |
Diagnose wind speed from its components.
xwind | X-component of wind [any unit] |
ywind | Y-component of wind [any unit] |
Vector version of wind speed calculation.
xwind | X-components of wind [any unit] |
ywind | Y-components of wind [any unit] |
|
static |
Missing value indicator.
|
static |
Missing value indicator in gridpp command-line tool.
|
static |
Mathematical constant pi.
|
static |
Radius of the earth [m].
|
static |
Default value used to fill array in SWIG testing functions.
Not useful for any other purpose.