Functions | |
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... | |
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... | |
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... | |
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. More... | |
Statistic | get_statistic (std::string name) |
Convert name of a statistic enum. More... | |
void | initialize_omp () |
Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined. More... | |
vec2 | nearest (const Grid &igrid, const Grid &ogrid, const vec2 ivalues) |
Nearest neighbour dowscaling grid to grid. More... | |
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 | neighbourhood (const vec2 &input, int radius, Statistic statistic) |
Spatial neighbourhood filter. More... | |
vec2 | neighbourhood_brute_force (const vec2 &input, int radius, Statistic statistic) |
Spatial neighbourhood filter without any shortcuts. More... | |
vec2 | neighbourhood_ens (const vec3 &input, int radius, Statistic statistic) |
Neighbourhood filter in space and across ensemble members. More... | |
vec2 | neighbourhood_quantile (const vec2 &input, float quantile, int radius) |
Spatial neighbourhood filter. More... | |
vec2 | neighbourhood_quantile_ens (const vec3 &input, float quantile, int radius) |
Neighbourhood filter in space and across ensemble members. More... | |
vec2 | neighbourhood_quantile_ens_fast (const vec3 &input, float quantile, int radius, const vec &thresholds) |
Approximate neighbourhood filter space and across members for quantile operation. More... | |
vec2 | neighbourhood_quantile_fast (const vec2 &input, float quantile, int radius, const vec &thresholds) |
Approximate spatial neighbourhood filter for quantile operation. More... | |
vec2 | optimal_interpolation (const gridpp::Grid &bgrid, const vec2 &background, const gridpp::Points &points, const vec &pobs, const vec &pratios, const vec &pbackground, const gridpp::StructureFunction &structure, int max_points) |
Optimal interpolation for a deterministic field. More... | |
vec3 | optimal_interpolation_ensi (const gridpp::Grid &bgrid, const vec3 &input, const gridpp::Points &points, const vec &pobs, const vec &psigmas, const vec2 &pbackground, const gridpp::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_transform (const gridpp::Grid &bgrid, const vec2 &background, float bsigma, const gridpp::Points &points, const vec &pobs, const vec &psigma, const vec &pbackground, const gridpp::StructureFunction &structure, int max_points, const gridpp::Transform &transform) |
float | pressure (float ielev, float oelev, float ipressure, float itemperature=288.15) |
Calculate pressure at a new elevation. 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... | |
vec2 | quantile_mapping (const vec2 &input, const vec &x, const vec &y, gridpp::Extrapolation policy) |
Quantile mapping of 2D grid using a constant quantile map. More... | |
vec | quantile_mapping (const vec &input, const vec &x, const vec &y, gridpp::Extrapolation policy) |
Quantile mapping of a vector of value. More... | |
float | quantile_mapping (float input, const vec &ref, const vec &fcst, gridpp::Extrapolation policy) |
Quantile mapping of a single value. More... | |
float | relative_humidity (float temperature, float dewpoint) |
Calculate relative humidity from temperature and dewpoint temperature. More... | |
void | set_omp_threads (int num) |
Set the number of OpenMP threads to use. 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) |
std::string | version () |
The gridpp version. More... | |
float | wetbulb (float temperature, float pressure, float relative_humidity) |
Calculate wetbulb temperature from temperature, pressure, and relative humidity. More... | |
float | wind_speed (float xwind, float ywind) |
Diagnose wind speed from its components. More... | |
vec | wind_speed (const vec &xwind, const vec &ywind) |
vec2 | wind_speed (const vec2 &xwind, const vec2 &ywind) |
Enumerations | |
enum | Extrapolation { OneToOne = 0, MeanSlope = 10, NearestSlope = 20, Zero = 30 } |
Methods for extrapolating outside a curve. 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 | Point |
class | Points |
Represents a vector of locations and their metadata. More... | |
class | StructureFunction |
Covariance structure function. More... | |
class | Transform |
Namespaces | |
util | |
Helper functions. | |
Variables | |
static const float | MV = NAN |
static const float | MV_CML = -999 |
static const float | pi = 3.14159265 |
static double | radius_earth = 6.37e6 |
Methods for extrapolating outside a curve.
enum gridpp::Statistic |
Statistical operations to reduce a vector to a scalar.
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 |
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] |
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 |
radiii | Circle radii for each point |
value | Fill in this value |
outside | if True, fill outside circles, if False, fill inside circles |
Calculate appropriate approximation thresholds for neighbourhood quantile.
input | 2D grid of values |
num_thresholds | Number of thresholds |
Calculate appropriate approximation thresholds for neighbourhood quantile.
input | 3D grid of values |
num_thresholds | Number of thresholds |
gridpp::Statistic gridpp::get_statistic | ( | std::string | name | ) |
Convert name of a statistic enum.
void gridpp::initialize_omp | ( | ) |
Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined.
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 | radius, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter.
input | 2D grid of values |
radius | Filter radius in number of gridpoints |
statistic | Statistic to compute |
vec2 gridpp::neighbourhood_brute_force | ( | const vec2 & | input, |
int | radius, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter without any shortcuts.
This is quite slow and is only useful for testing.
input | 2D grid of values |
radius | Filter radius in number of gridpoints |
operation | one of min, mean, median, max |
vec2 gridpp::neighbourhood_ens | ( | const vec3 & | input, |
int | radius, | ||
gridpp::Statistic | statistic | ||
) |
Neighbourhood filter in space and across ensemble members.
input | 3D vector with dimensions (Y, X, ensemble) |
radius | Filter radius in number of gridpoints |
statistic | Statistic to compute |
Spatial neighbourhood filter.
An exact but slow algorithm.
input | 2D grid of values |
radius | Filter radius in number of gridpoints |
quantile | Quantile to calculate for (between 0 and 1) |
Neighbourhood filter in space and across ensemble members.
An exampt but slow algorithm.
input | 3D grid of values |
radius | Filter radius in number of gridpoints |
quantile | Quantile to calculate for (between 0 and 1) |
vec2 gridpp::neighbourhood_quantile_ens_fast | ( | const vec3 & | input, |
float | quantile, | ||
int | radius, | ||
const vec & | thresholds | ||
) |
Approximate neighbourhood filter space and across members for quantile operation.
input | 3D vector with dimensions (Y, X, ensemble) |
quantile | Quantile to compute (between 0 and 1) |
radius | Filter radius in number of gridpoints |
thresholds | Vector of thresholds to use to approximate value |
vec2 gridpp::neighbourhood_quantile_fast | ( | const vec2 & | input, |
float | quantile, | ||
int | radius, | ||
const vec & | thresholds | ||
) |
Approximate spatial neighbourhood filter for quantile operation.
input | 2D grid of values |
quantile | Quantile to compute (between 0 and 1) |
radius | Filter radius in number of gridpoints |
thresholds | Vector of thresholds to use to approximate value |
vec2 gridpp::optimal_interpolation | ( | const gridpp::Grid & | bgrid, |
const vec2 & | background, | ||
const gridpp::Points & | points, | ||
const vec & | pobs, | ||
const vec & | pratios, | ||
const vec & | pbackground, | ||
const gridpp::StructureFunction & | structure, | ||
int | max_points | ||
) |
Optimal interpolation for a deterministic 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 |
vec3 gridpp::optimal_interpolation_ensi | ( | const gridpp::Grid & | bgrid, |
const vec3 & | input, | ||
const gridpp::Points & | points, | ||
const vec & | pobs, | ||
const vec & | psigmas, | ||
const vec2 & | pbackground, | ||
const gridpp::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_transform | ( | const gridpp::Grid & | bgrid, |
const vec2 & | background, | ||
float | bsigma, | ||
const gridpp::Points & | points, | ||
const vec & | pobs, | ||
const vec & | psigma, | ||
const vec & | pbackground, | ||
const gridpp::StructureFunction & | structure, | ||
int | max_points, | ||
const gridpp::Transform & | transform | ||
) |
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 |
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] |
vec2 gridpp::quantile_mapping | ( | const vec2 & | input, |
const vec & | x, | ||
const vec & | y, | ||
gridpp::Extrapolation | policy | ||
) |
Quantile mapping of 2D grid using a constant quantile map.
input | Values on grid |
x | X-axis parameters values |
y | Y-axis parameters values |
policy | Extrapolation policy |
vec gridpp::quantile_mapping | ( | const vec & | input, |
const vec & | x, | ||
const vec & | y, | ||
gridpp::Extrapolation | policy | ||
) |
Quantile mapping of a vector of value.
input | Input values |
x | X-axis parameters values |
y | Y-axis parameters values |
policy | Extrapolation policy |
float gridpp::quantile_mapping | ( | float | input, |
const vec & | ref, | ||
const vec & | fcst, | ||
gridpp::Extrapolation | policy | ||
) |
Quantile mapping of a single value.
input | Input value |
x | X-axis parameters values |
y | Y-axis parameters values |
policy | Extrapolation policy |
float gridpp::relative_humidity | ( | float | temperature, |
float | dewpoint | ||
) |
Calculate relative humidity from temperature and dewpoint temperature.
temperature | Temperature [K] |
dewpoint | Dewpoint temperature [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 | ||
) |
std::string gridpp::version | ( | ) |
The gridpp version.
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] |
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] |
|
static |
|
static |
|
static |
|
static |