Typedefs | |
Short-hand notation for vectors of different dimensions sizes | |
typedef std::vector< float > | vec |
1D float vector More... | |
typedef std::vector< vec > | vec2 |
2D float vector More... | |
typedef std::vector< vec2 > | vec3 |
3D float vector More... | |
typedef std::vector< int > | ivec |
1D integer vector More... | |
typedef std::vector< ivec > | ivec2 |
2D integer vector More... | |
typedef std::vector< ivec2 > | ivec3 |
3D integer vector More... | |
typedef std::vector< double > | dvec |
1D double vector More... | |
typedef std::vector< dvec > | dvec2 |
2D double vector More... | |
Functions | |
Data assimilation methods | |
Functions that merge observations with a background field | |
vec2 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 across ensemble members. 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 levels. 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 ensemble neighbourhood filter without any shortcuts. More... | |
vec | get_neighbourhood_thresholds (const vec2 &input, int num_thresholds) |
Calculate appropriate approximation thresholds for fast 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 | 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 | 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 | 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 | |
vec | quantile_mapping_curve (const vec &ref, const vec &fcst, vec &output_fcst, vec quantiles=vec()) |
Create quantile mapping calibration curve. More... | |
vec | 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 | 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 | 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 | 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 | 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 | monotonize_curve (vec curve_ref, vec curve_fcst, vec &output_fcst) |
Ensure calibration curve is monotonic, by removing points on the curve. More... | |
float | 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 | calc_score (float a, float b, float c, float d, Metric metric) |
Compute the score for a 2x2 contingency table. More... | |
float | calc_score (const vec &ref, const vec &fcst, float threshold, Metric metric) |
Compute the score for a 2x2 contingency table by thresholding. More... | |
float | 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 | downscaling (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues, Downscaler downscaler) |
Downscale a gridded field. More... | |
vec3 | downscaling (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues, Downscaler downscaler) |
Downscale a gridded ensemble field. More... | |
vec | downscaling (const Grid &igrid, const Points &opoints, const vec2 &ivalues, Downscaler downscaler) |
Downscale a gridded field to points. More... | |
vec2 | downscaling (const Grid &igrid, const Points &opoints, const vec3 &ivalues, Downscaler downscaler) |
Downscale a gridded ensemble field to points. More... | |
vec2 | nearest (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues) |
Nearest neighbour dowscaling grid to grid for a deterministic field. More... | |
vec3 | nearest (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues) |
Nearest neighbour dowscaling grid to grid for an ensemble field. More... | |
vec | nearest (const Grid &igrid, const Points &opoints, const vec2 &ivalues) |
Nearest neighbour dowscaling grid to point for a deterministic field. More... | |
vec2 | nearest (const Grid &igrid, const Points &opoints, const vec3 &ivalues) |
Nearest neighbour dowscaling grid to point for an ensemble field. More... | |
vec | nearest (const Points &ipoints, const Points &opoints, const vec &ivalues) |
Nearest neighbour dowscaling point to point for a deterministic field. More... | |
vec2 | nearest (const Points &ipoints, const Points &opoints, const vec2 &ivalues) |
Nearest neighbour dowscaling point to point for an ensemble field. More... | |
vec2 | nearest (const Points &ipoints, const Grid &ogrid, const vec &ivalues) |
Nearest neighbour dowscaling point to grid for a deterministic field. More... | |
vec3 | nearest (const Points &ipoints, const Grid &ogrid, const vec2 &ivalues) |
Nearest neighbour dowscaling point to grid for an ensemble field. More... | |
vec2 | 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 | 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 | 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 | bilinear (const Grid &igrid, const Grid &ogrid, const vec2 &ivalues) |
Bilinear downscaling grid to grid for a deterministic field. More... | |
vec3 | bilinear (const Grid &igrid, const Grid &ogrid, const vec3 &ivalues) |
Bilinear dowscaling grid to grid for an ensemble field. More... | |
vec | bilinear (const Grid &igrid, const Points &opoints, const vec2 &ivalues) |
Bilinear dowscaling grid to point for a deterministic field. More... | |
vec2 | bilinear (const Grid &igrid, const Points &opoints, const vec3 &ivalues) |
Bilinear dowscaling grid to point for an ensemble field. More... | |
vec2 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | count (const Grid &grid, const Points &points, float radius) |
For each point, counts the number of gridpoints within the radius. More... | |
vec2 | count (const Grid &igrid, const Grid &ogrid, float radius) |
For each gridpoint, 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 | count (const Points &ipoints, const Points &opoints, float radius) |
For each point, 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... | |
vec | distance (const Points &ipoints, const Points &opoint, int num=1) |
For each output point, calculates the distance to nearest input 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... | |
vec | gridding (const Points &opoints, const Points &ipoints, const vec &values, float radius, int min_num, Statistic statistic) |
Aggregate points onto a points. More... | |
vec2 | 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 | 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 | 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 | 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 | 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 | 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 | 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... | |
int | get_omp_threads () |
Get the number of OpenMP threads currently set. More... | |
void | 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 | 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... | |
static const float | lapse_rate =0.0065 |
Constant Lapse Rate moist air standard atmosphere [K/m]. More... | |
static const float | standard_surface_temperature = 288.15 |
Temperature at surface in standard atmosphere [K]. More... | |
static const float | gravit = 9.80665 |
Gravitational acceleration [m/s^2]. More... | |
static const float | molar_mass = 0.0289644 |
Molar Mass of Dry Air [kg/mol]. More... | |
static const float | gas_constant_mol = 8.31447 |
Universal Gas Constant [kg*m^2*s^-2/(K*mol)]. More... | |
static const float | gas_constant_si = 287.05 |
Universal Gas Constant [J/(kg*K)]. More... | |
Enumerations | |
enum | ComparisonOperator { Lt = 0, Leq = 10, Gt = 20, Geq = 30 } |
Types of comparison operators. More... | |
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 | Downscaler { Nearest = 0, Bilinear = 1 } |
Types of simple downscaling methods. More... | |
enum | Extrapolation { OneToOne = 0, MeanSlope = 10, NearestSlope = 20, Zero = 30, Unchanged = 40 } |
Methods for extrapolating outside a curve. More... | |
enum | GradientType { MinMax = 0, LinearRegression = 10 } |
Types of methods to calculate the gradient. 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, Count = 80, RandomChoice = 90, 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 |
Box-Cox transformation. More... | |
class | CressmanStructure |
Simple structure function based on distance, elevation, and land area fraction. More... | |
class | CrossValidation |
class | Gamma |
Gamma transformation. More... | |
class | Grid |
Represents a 2D grid of locations and their metadata. More... | |
class | Identity |
Identity transform, i.e. More... | |
class | KDTree |
Helper class for Grid and Points representing a tree of points. More... | |
class | Log |
Log transformation: output = log(input) More... | |
class | MultipleStructure |
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 |
Utilities | |
Helper functions | |
static int | _debug_level = 0 |
void | set_debug_level (int level) |
Set the verbosity of debug messages. More... | |
int | get_debug_level () |
Get the currently set level of debug messagess. More... | |
Statistic | get_statistic (std::string name) |
Convert name of a statistic enums. More... | |
std::string | version () |
The gridpp version. More... | |
double | clock () |
The current time. More... | |
void | debug (std::string string) |
Writes a debug message to standard out. More... | |
void | warning (std::string string) |
Writes a warning message to standard out. More... | |
void | error (std::string string) |
Writes an error message to standard out. More... | |
void | future_deprecation_warning (std::string function, std::string other="") |
Writes an deprecation warning to standard out. More... | |
bool | is_valid (float value) |
Checks if a value is valid. More... | |
float | calc_statistic (const vec &array, Statistic statistic) |
Compute a statistic on a 1D vector. More... | |
float | calc_quantile (const vec &array, float quantile_level) |
Compute a quantile from a 1D vector. More... | |
vec | calc_statistic (const vec2 &array, Statistic statistic) |
Compute a statistic on a 2D vector. More... | |
vec | calc_quantile (const vec2 &array, float quantile=MV) |
Compute a quantile from a 2D vector. More... | |
vec2 | calc_quantile (const vec3 &array, const vec2 &quantile_levels) |
Compute quantile with 2D varying quantile level. More... | |
bool | 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 | 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 | is_valid_lat (float lat, CoordinateType type) |
Checks that a lat-coordinate is valid (based on the coordinate type) More... | |
bool | is_valid_lon (float lon, CoordinateType type) |
Checks that a lon-coordinate is valid (based on the coordinate type) More... | |
int | num_missing_values (const vec2 &iArray) |
Count the number of missing values in a vector. More... | |
int | 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 | 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 | 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 | interpolate (const vec &x, const vec &iX, const vec &iY) |
Piecewise linear interpolation, vectorised version. More... | |
ivec2 | init_ivec2 (int Y, int X, int value) |
Initialize a 2D integer vector of size Y, X, with a given value. More... | |
vec2 | init_vec2 (int Y, int X, float value=MV) |
Initialize a 2D float vector of size Y, X, with a given value. More... | |
ivec3 | 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 | 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 | 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 | 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 | 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) |
Check if the grid is compatible with 3D vector. More... | |
bool | compatible_size (const Points &points, const vec &v) |
Check if the points are compatible with a 1D vector. More... | |
bool | compatible_size (const Points &points, const vec2 &v) |
Check if the points are compatible with a 2D vector. More... | |
bool | compatible_size (const vec2 &a, const vec2 &b) |
Check if two 2D vectors are compatible. More... | |
bool | compatible_size (const vec2 &a, const vec3 &b) |
Check if a 2D and 3D vectors are compatible. More... | |
bool | compatible_size (const vec3 &a, const vec3 &b) |
Check if two 3D vectors are compatible. More... | |
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... | |
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 |
1D double vector
typedef std::vector<dvec> gridpp::dvec2 |
2D double vector
typedef std::vector<int> gridpp::ivec |
1D integer vector
typedef std::vector<ivec> gridpp::ivec2 |
2D integer vector
typedef std::vector<ivec2> gridpp::ivec3 |
3D integer vector
typedef std::vector<float> gridpp::vec |
1D float vector
typedef std::vector<vec> gridpp::vec2 |
2D float vector
typedef std::vector<vec2> gridpp::vec3 |
3D float vector
enum gridpp::Downscaler |
Methods for extrapolating outside a curve.
enum gridpp::GradientType |
enum gridpp::Metric |
enum gridpp::Statistic |
Statistical operations to reduce a vector to a scalar.
float gridpp::apply_curve | ( | float | fcst, |
const vec & | curve_ref, | ||
const vec & | curve_fcst, | ||
gridpp::Extrapolation | policy_below, | ||
gridpp::Extrapolation | policy_above | ||
) |
Apply arbitrary calibration curve to a single value.
fcst | 1D vector of forecast values to correct |
curve_ref | 1D vector of reference curve values |
curve_fcst | 1D vector of forecast curve values |
policy_below | Extrapolation policy below curve |
policy_above | Extrapolation policy above curve |
vec gridpp::apply_curve | ( | const vec & | fcst, |
const vec & | curve_ref, | ||
const vec & | curve_fcst, | ||
gridpp::Extrapolation | policy_below, | ||
gridpp::Extrapolation | policy_above | ||
) |
Apply arbitrary calibration curve to 1D forecasts.
fcst | 1D vector of forecast values to correct |
curve_ref | 1D vector of reference curve values |
curve_fcst | 1D vector of forecast curve values |
policy_below | Extrapolation policy below curve |
policy_above | Extrapolation policy above curve |
vec2 gridpp::apply_curve | ( | const vec2 & | fcst, |
const vec & | curve_ref, | ||
const vec & | curve_fcst, | ||
gridpp::Extrapolation | policy_below, | ||
gridpp::Extrapolation | policy_above | ||
) |
Apply arbitrary calibration curve to 2D forecasts.
fcst | 2D vector of forecast values to correct |
curve_ref | 1D vector of reference curve values |
curve_fcst | 1D vector of forecast curve values |
policy_below | Extrapolation policy below curve |
policy_above | Extrapolation policy above curve |
vec2 gridpp::apply_curve | ( | const vec2 & | fcst, |
const vec3 & | curve_ref, | ||
const vec3 & | curve_fcst, | ||
gridpp::Extrapolation | policy_below, | ||
gridpp::Extrapolation | policy_above | ||
) |
Apply arbitrary calibration curve to 2D forecasts with spatially varying QQ map.
fcst | 2D vector of forecast values to correct |
curve_ref | 3D vector of reference curve values (Y, X, Curve) |
curve_fcst | 3D vector of Forecast curve values (Y, X, Curve) |
policy_below | Extrapolation policy below curve |
policy_above | Extrapolation policy above curve |
Get reasonably spaced quantile levels from a vector of values, ignoring duplicate values but including the first number after duplicated values.
Include the lowest and highest values.
values | 1D vector of values (unsorted, and no invalid values) |
num | number of thresholds to get |
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.
base | 2D vector of dependent values, missing values are ignored (Y, X) |
values | 2D vector of independent values, missing values are ignored (Y, X) |
gradient_type | What gradient type to compute |
halfwidth | Neighbourhood half width 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 of points not available |
float gridpp::calc_quantile | ( | const vec & | array, |
float | quantile_level | ||
) |
Compute a quantile from a 1D vector.
array | 1D vector of values |
quantile_level | Quantile level to compute |
Compute a quantile from a 2D vector.
array | 2D vector of values (Y, X) |
quantile_level | Quantile level to compute |
Compute quantile with 2D varying quantile level.
array | 3D input vector (T, Y, X) |
quantile | 2D vector of Quantile levels (Y, X) |
float gridpp::calc_score | ( | float | a, |
float | b, | ||
float | c, | ||
float | d, | ||
gridpp::Metric | metric | ||
) |
Compute the score for a 2x2 contingency table.
a | Fraction of hits |
b | Fraction of false alarms |
c | Fraction of misses |
d | Fraction of correct rejections |
metric | Metric to conpute score for |
float gridpp::calc_score | ( | const vec & | ref, |
const vec & | fcst, | ||
float | threshold, | ||
gridpp::Metric | metric | ||
) |
Compute the score for a 2x2 contingency table by thresholding.
ref | 1D vector of reference values |
fcst | 1D vector forecast values |
threshold | Threshold to compute score for |
metric | Metric to conpute score for |
float gridpp::calc_score | ( | const vec & | ref, |
const vec & | fcst, | ||
float | threshold, | ||
float | fthreshold, | ||
gridpp::Metric | metric | ||
) |
Compute the score for a 2x2 contingency table by thresholding and allowing a different threshold for the forecast.
ref | 1D vector of reference values |
fcst | 1D vector forecast values |
threshold | Threshold for the reference values |
fthreshold | Threshold for the forecast values |
metric | Metric to conpute score for |
float gridpp::calc_statistic | ( | const vec & | array, |
gridpp::Statistic | statistic | ||
) |
Compute a statistic on a 1D vector.
array | 1D vector of values |
statistic | Statistic to compute |
vec gridpp::calc_statistic | ( | const vec2 & | array, |
gridpp::Statistic | statistic | ||
) |
Compute a statistic on a 2D vector.
array | 2D vector of values (Y, X) |
statistic | Statistic to compute |
double gridpp::clock | ( | ) |
The current time.
Check if the grid is the same size as the 2D vector.
grid | Grid (Y, X) |
v | 2D vector (Y, X) |
Check if the grid is compatible with 3D vector.
grid | Grid (Y, X) |
v | 3D vector (T, Y, X) |
Check if the points are compatible with a 1D vector.
grid | Points |
v | 1D vector |
Check if the points are compatible with a 2D vector.
grid | Points (P) |
v | 2D vector (T, P) |
Check if two 2D vectors are compatible.
a | 2D vector (Y, X) |
b | 2D vector (Y, X) |
Check if a 2D and 3D vectors are compatible.
a | 2D vector (Y, X) |
b | 3D vector (Y, X, E) |
Check if two 3D vectors are compatible.
a | 3D vector (Y, X, E) |
b | 3D vector (Y, X, E) |
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.
lats | vector of latitudes [deg] or 2D y-coordinates [m] |
lons | vector of longitudes [deg] or 2D x-coordinates [m] |
type | Coordinate type for lats and lons |
x_coords | vector of x-coordinates [m] |
y_coords | vector of y-coordinates [m] |
z_coords | vector of z-coordinates [m] |
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.
lat | vector of latitudes [deg] or 2D y-coordinates [m] |
lon | vector of longitudes [deg] or 2D x-coordinates [m] |
type | Coordinate type for lat and lon |
x_coord | x-coordinate [m] |
y_coord | y-coordinate [m] |
z_coord | z-coordinate [m] |
For each point, counts the number of gridpoints within the radius.
grid | Input grid |
points | Output points |
radius | Radius [m] |
For each gridpoint, counts the number of gridpoints within the radius.
igrid | Input grid |
ogrid | Output grid |
radius | Radius [m] |
For each gridpoint, counts the number of points within the radius.
points | Input points |
grid | Output grid |
radius | Radius [m] |
For each point, counts the number of points within the radius.
ipoints | Input points (Pi) |
opoints | Output points (Po) |
radius | Radius [m] |
void gridpp::debug | ( | std::string | string | ) |
Writes a debug message to standard out.
string | Write this 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 | 1D vector of temperature [K] |
relative_humidity | 1D vector of relative humidity [1] |
For each output gridpoint, calculate the distance to nearest input gridpoint.
grid | Grid (Yi, Xi) |
ogrid | Output grid /Yo, Xo) |
num | Number of points |
For each output point, calculates the distance to nearest input point.
ipoints | Input points (Pi) |
opoints | Output points (Po) |
num | Number of points |
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.
grid | Grid of background |
background | 2D vector of background values with (Y, X) |
points | Points of observations |
observations | 1D vector of observations |
radii | Radius of circle where observations are inserted for each point [m] |
max_elev_diff | Only insert where elevation difference between grid and point is less than this value |
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.
grid | Grid of background |
background | 2D vector of background values (Y, X) |
points | Points of observations |
observations | 1D vector of observations |
halfwidths | Half width of square (in number of grid points) where observations are inserted for each point |
max_elev_diff | Only insert where elevation difference between grid and point is less than this value [m] |
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.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues | 3D vector of input values (Yi, Xi, E) |
threshold | 2D vector of threshold values (Yo, Xo) |
comparison_operator | Comparison operator to create probability |
vec2 gridpp::downscaling | ( | const Grid & | igrid, |
const Grid & | ogrid, | ||
const vec2 & | ivalues, | ||
Downscaler | downscaler | ||
) |
vec3 gridpp::downscaling | ( | const Grid & | igrid, |
const Grid & | ogrid, | ||
const vec3 & | ivalues, | ||
Downscaler | downscaler | ||
) |
vec gridpp::downscaling | ( | const Grid & | igrid, |
const Points & | opoints, | ||
const vec2 & | ivalues, | ||
Downscaler | downscaler | ||
) |
vec2 gridpp::downscaling | ( | const Grid & | igrid, |
const Points & | opoints, | ||
const vec3 & | ivalues, | ||
Downscaler | downscaler | ||
) |
void gridpp::error | ( | std::string | string | ) |
Writes an error message to standard out.
string | Write this 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 (useful for masking)
igrid | Grid of input |
input | 2D vector of values (Y, X) |
points | Points to fill in |
radii | 1D vector of circle radii for each point [m] |
value | Value to fill in |
outside | If True, fill outside circles, if False, fill inside circles |
Fill in missing values based on nearby values.
values | 2D vector of values |
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.
igrid | input grid |
ogrid | output grid |
ivalues | values from igrid |
elev_gradient | elevation gradient |
laf_gradient | land area fraction gradientSpatially varying gradient dowscaling grid to grid for a deterministic field |
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues | 2D vector of input values (Yi, Xi) |
elev_gradient | 2D vector of elevation gradients (Yi, Xi) [input unit/m] |
laf_gradient | 2D vector of land-area-fraction gradients (Yi, Xi) [input unit/1] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues | 3D vector of input values (E, Yi, Xi) |
elev_gradient | 3D vector of elevation gradients (Yi, Xi, E) [input unit/m] |
laf_gradient | 3D vector of land-area-fraction gradients (Yi, Xi, E) [input unit/1] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
opoints | Points of downscaled output |
ivalues | 2D vector of input values grid (Yi, Xi) |
elev_gradient | 2D vector of elevation gradients (Yi, Xi) [input unit/m] |
laf_gradient | 2D vector of land-area-fraction gradients (Yi, Xi) [input unit/1] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
opoints | Points of downscaled output |
ivalues | 3D vector of input values (E, Yi, Xi) |
elev_gradient | 3D vector of elevation gradients (E, Yi, Xi) [input unit/m] |
laf_gradient | 3D vector of land-area-fraction gradients (E, Yi, Xi) [input unit/1] |
downscaler | Downscaling method |
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 |
||
) |
void gridpp::future_deprecation_warning | ( | std::string | function, |
std::string | other = "" |
||
) |
Writes an deprecation warning to standard out.
string | Name of the deprecated function |
other | Additional message to write |
Extract quantiles from a gamma distribution.
levels | 1D vector of quantile levels to retrieve |
shape | 1D vector of shape parameter of gamma distribution |
scale | 1D vector of scale parameter of gamma distribution |
int gridpp::get_debug_level | ( | ) |
Get the currently set level of debug messagess.
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.
iX | Lookup value |
iValues | 1D vector of lookup values. Must be sorted. |
Calculate appropriate approximation thresholds for fast neighbourhood quantile.
input | 2D vector of values (Y, X) |
num_thresholds | Number of thresholds |
Calculate appropriate approximation thresholds for neighbourhood quantile based on an ensemble.
input | 3D vector of values (Y, X, T) |
num_thresholds | Number of thresholds |
int gridpp::get_omp_threads | ( | ) |
Get the number of OpenMP threads currently set.
float gridpp::get_optimal_threshold | ( | const vec & | curve_ref, |
const vec & | curve_fcst, | ||
float | threshold, | ||
gridpp::Metric | metric | ||
) |
Compute the optimal threshold to remap an input threshold to.
curve_ref | 1D vector of reference curve values |
curve_fcst | 1D vector of reference curve values |
threshold | Input threshold |
metric | Metric to optimize |
gridpp::Statistic gridpp::get_statistic | ( | std::string | name | ) |
Convert name of a statistic enums.
name | Name of a statistic |
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.
iX | Lookup value |
iValues | 1D vector of lookup values. 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 gridpp::MV where there are not enough points.
grid | Output grid to aggregate to |
points | Input points |
values | 1D vector of input values |
radius | Circle radius for aggregating points [m] |
min_num | Minimum number of points in radius to create a value |
statistic | Statistic to compute on points within radius |
vec gridpp::gridding | ( | const Points & | opoints, |
const Points & | ipoints, | ||
const vec & | values, | ||
float | radius, | ||
int | min_num, | ||
gridpp::Statistic | statistic | ||
) |
Aggregate points onto a points.
Writes gridpp::MV where there are not enough points.
opoints | Output points to aggregate to |
ipoints | Input points |
values | 1D vector of input Values |
radius | Circle radius for aggregate points [m] |
min_num | Minimum number of points in radius to create a value |
statistic | Statistic to compute on points within radius |
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.
Writes gridpp::MV where there are not enough observations.
grid | Output grid to aggregate to |
points | Input points |
values | Input values |
min_num | Minimum number of points in a gridpoint to create a value |
statistic | Statistic to compute on points within gridpoint |
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.
Writes gridpp::MV where there are not enough observations.
opoints | Output points to aggregate to |
ipoints | Input points |
values | Input values |
min_num | Minimum number of points in a gridpoint to create a value |
statistic | Statistic to compute on points within gridpoint |
ivec2 gridpp::init_ivec2 | ( | int | Y, |
int | X, | ||
int | value | ||
) |
Initialize a 2D integer vector of size Y, X, with a given value.
Y | Size of first dimension |
X | Size of second dimension value Initialize with this value |
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.
Y | Size of first dimension |
X | Size of second dimension |
E | Size of third dimension value Initialize with this value |
Initialize a 2D float vector of size Y, X, with a given value.
Y | Size of first dimension |
X | Size of second dimension value Initialize with this value |
Initialize a 3D float vector of size Y, X, E, with a given value.
Y | Size of first dimension |
X | Size of second dimension |
E | Size of third dimension value Initialize with this value |
void gridpp::initialize_omp | ( | ) |
Sets the number of OpenMP threads to 1 if OMP_NUM_THREADS undefined.
Piecewise linear interpolation If x is outside the range of iX, then the min/max value of iY is used.
If there are multiple identical x values, then the average of the y values at each end of the x-interval that is constant is used. The exception is if the constant interval is on one (only) of the edges of the interpolation curve. In that case, the y-value at the end of the interval further away from the boundary of the curve is used.
x | Interpolation to this point |
iX | 1D vector of x-axis values. Vector must be sorted. |
iY | 1D vector of y-axis values corresponding to iX. |
Piecewise linear interpolation, vectorised version.
x | 1D vector of values to interpolate to |
iX | 1D vector of x-axis values. Vector must be sorted. |
iY | 1D vector of y-axis values corresponding to iX. |
bool gridpp::is_valid | ( | float | value | ) |
Checks if a value is valid.
value | Value to check |
bool gridpp::is_valid_lat | ( | float | lat, |
CoordinateType | type | ||
) |
Checks that a lat-coordinate is valid (based on the coordinate type)
lat | latitude [deg] or y-coordinate [m] |
type | Coordinate type for lat |
bool gridpp::is_valid_lon | ( | float | lon, |
CoordinateType | type | ||
) |
Checks that a lon-coordinate is valid (based on the coordinate type)
lat | longitude [deg] or x-coordinate [m] |
type | Coordinate type for lon |
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.
This is an experimental method.
bgrid | Grid of background field |
background | 2D vector of background values (Y, X) |
obs_points | Points of observations |
obs | 1D vector of observations |
background_at_points | 1D vector of background values at observation points |
structure | Structure function |
min_quantile | Truncate quantile map below this quantile level |
max_quantile | Truncate quantile map above this quantile level |
max_points | Maximum number of points used within localization radius (not used at moment) |
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.
This is an experimental method. Version with multiple number of timesteps. Pool all observations across time in when computing the calibration curve.
bgrid | Grid of background |
background | 2D vector of background values (Y, X) |
obs_points | Points of observations |
obs | 2D vector of observations (Time, Points) |
background_at_points | 2D vector of background values at observation points (Time, Points) |
structure | structure function |
min_quantile | Truncate quantile map below this quantile |
max_quantile | Truncate quantile map above this quantile |
max_points | Maximum number of points used within localization radius (not used at moment) |
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.
This method computes a high-resolution consensus from a low-resolution ensemble, without downscaling all members. See the wiki for more details.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues_true | 3D vector of input values to use when condition is true (Yi, Xi, E) |
ivalues_false | 3D vector of input values to use when condition is false (Yi, Xi, E) |
threshold_values | 3D vector of values (Yi, Xi, E) defining the mask for ivalues after applying the theshold |
threshold | 2D vector of thresholds on output grid that is upscaled to input grid (Yo, Xo) |
comparison_operator | Comparison operator to create probability |
statistic | statistic to compute over the ensemble dimension after downscaling |
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.
This method extractes a quantile for a high-resolution grid from a low-resolution ensemble, without downscaling all members. See the wiki for more details.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues_true | 3D vector of input values to use when condition is true (Yi, Xi, E) |
ivalues_false | 3D vector of input values to use when condition is false (Yi, Xi, E) |
threshold_values | 3D vector of values (Yi, Xi, E) defining the mask for ivalues after applying the theshold |
threshold | 2D vector of thresholds on output grid that is upscaled to input grid (Yo, Xo) |
comparison_operator | Comparison operator to create probability |
quantile_level | Quantile level (between 0 and 1) to extract |
vec gridpp::metric_optimizer_curve | ( | const vec & | ref, |
const vec & | fcst, | ||
const vec & | thresholds, | ||
gridpp::Metric | metric, | ||
vec & | output_fcst | ||
) |
Create calibration curve that optimizes a metric.
ref | 1D vector of reference values (observations) |
fcst | 1d vector of forecast values |
thresholds | 1D vector of thresholds for computing optimal values for |
metric | A Metric to optimize for |
output_fcst | 1D vector of output forecast quantiles |
Ensure calibration curve is monotonic, by removing points on the curve.
curve_ref | 1D vector of reference curve values |
curve_fcst | 1D vector of forecast curve values |
output_fcst | 1D vector of output forecast curve values |
vec2 gridpp::neighbourhood | ( | const vec2 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Spatial neighbourhood filter, computing a statistic for a sliding square window.
input | 2D vector of input values (Y, X) |
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.
Computes static across neighbourhood and all members
input | 3D vector of input values (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 vector of values (Y, X) |
halfwidth | Filter halfwidth in number of gridpoints |
statistic | Statistic to compute |
vec2 gridpp::neighbourhood_brute_force | ( | const vec3 & | input, |
int | halfwidth, | ||
gridpp::Statistic | statistic | ||
) |
Spatial ensemble neighbourhood filter without any shortcuts.
This is quite slow and is only useful for testing.
input | 3D vector of values (Y, X, E) |
halfwidth | Filter halfwidth in number of gridpoints |
statistic | Statistic to compute |
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 vector 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 across ensemble members.
input | 3D vector of values (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 vector of values (Y, X) |
quantile | Quantile to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | 1D 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 vector of values (Y, X, E) |
quantile | Quantile to compute (between 0 and 1) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | 1D 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 levels.
input | 2D vector of values (Y, X) |
quantile | 2D vector quantile levels to compute (between 0 and 1) (Y, X) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | 1D 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 vector of values with dimensions (Y, X, E) |
quantile | 2D vector of quantile levels to compute (between 0 and 1) (Y, X) |
halfwidth | Filter halfwidth in number of gridpoints |
thresholds | 1D vector of thresholds to use to approximate value |
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.
This is an experimental method.
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.
If values are found within the range, then the average of the values are used. If not, the closest point to the range is used, provided this is within search_delta of the criteria range. if no point fulfills this, the original value is not modified.
input | 2D vector of input values, e.g. temperatures (Y, X) |
search_array | 2D vector to search in, e.g. land area fraction (Y, X) |
halfwidth | Neighbourhood halfwidth to search in |
search_target_min | Lower bound of criteria, e.g. a land area fraction value |
search_target_Max | Upper bound of criteria, e.g. a land area fraction value |
search_delta | Max distance outside target range where the most suitable point is still used |
apply_array | 2D integer vector of 1 (correct this grid point) or 0 (don't correct) |
int gridpp::num_missing_values | ( | const vec2 & | iArray | ) |
Count the number of missing values in a vector.
array | 2D vector |
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.
bgrid | Grid of background field |
background | 2D field of background values |
obs_points | Points of observations |
obs | 1D vector of observations |
variance_ratios | 1D vector of ratio of observation to background error variance |
background_at_points | 1D vector of background at observation points |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
allow_extrapolation | Allow OI to extrapolate increments outside increments at observations points |
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.
bpoints | Points of background field |
background | 1D field of background values |
obs_points | Points of observations |
obs | 1D vector of observations |
variance_ratios | 1D vector of ratio of observation to background error variance |
background_at_points | 1D vector of background at observation points |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
allow_extrapolation | Allow OI to extrapolate increments outside increments at observations points |
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)
bgrid | Grid of background field |
background | 3D vector of background values (Y, X, E) |
obs_points | observation points |
obs | 1D vector of observations |
obs_standard_deviations | 1D vector of observation standard deviations |
background_at_points | 2D vector of background at observation points (L, E) |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
allow_extrapolation | Allow OI to extrapolate increments outside increments at observations |
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)
bpoints | Points of background field |
background | 2D vector of background values (L, E) |
obs_points | Observation points |
obs | 1D vector of observations |
obs_standard_deviations | 1D vector of observation standard deviations |
background_at_points | 2D vector of background at observation points (L, E) |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
allow_extrapolation | Allow OI to extrapolate increments outside increments at observations |
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.
bgrid | Grid of background field |
background | 2D vector of background values |
bvariance | 2D vector of background variances |
obs_points | Points of observations |
obs | 1D vector of observations |
obs_variance | 1D vector of observation variances |
background_at_points | 1D vector of background at observation points |
bvariance_at_points | 1D vector of background variance at observation points |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
analysis_variance | 2D output vector of analysis variance |
allow_extrapolation | Allow OI to extrapolate increments outside increments at observations |
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.
bpoints | Points of background field |
background | 1D vector of background values |
bvariance | 1D vector of background variance |
obs_points | Points of observations |
obs | 1D vector of observations |
obs_variance | 1D vector of observation variances |
background_at_points | 1D vector of background at observation points |
bvariance_at_points | 1D vector of background variance at observation points |
structure | Structure function |
max_points | Maximum number of observations to use inside localization zone; Use 0 to disable |
analysis_variance | 1D output vector of analysis variance |
allow_extrapolation | Allow OI to extrapolate increments outside increments at observations |
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 [m] |
oelev | Elevation at new point [m] |
ipressure | Pressure at start point [Pa] |
itemperature | Temperature at start point [K] |
vec gridpp::pressure | ( | const vec & | ielev, |
const vec & | oelev, | ||
const vec & | ipressure, | ||
const vec & | itemperature | ||
) |
Calculate Vector version of pressure calculation.
ielev | 1D vector of elevation at start point [m] |
oelev | 1D vector of elevation at new point [m] |
ipressure | 1D vector of pressure at start point [Pa] |
itemperature | 1D vector of temperature at start point [K] |
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 | 1D vector of Pressure [Pa] |
altitude | 1D vector of altitude [m] |
vec gridpp::quantile_mapping_curve | ( | const vec & | ref, |
const vec & | fcst, | ||
vec & | output_fcst, | ||
vec | quantiles = vec() |
||
) |
Create quantile mapping calibration curve.
ref | 1D vector of reference values (observations) |
fcst | 1D vector of forecast values |
output_fcst | 1D vector of output forecast quantiles |
quantiles | 1D vector of quantile levels 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 | 1D vector of temperature [K] |
dewpoint | 1D vector of dewpoint temperature [K] |
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.
ps | Surface pressure [Pa] |
altitude | Station altitude above sea level [m] |
temperature | 2m temperature [K] |
rh | 2m Relative humidity [1] |
dewpoint | 2m Dewpoint Temperature at station [K] |
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.
ps | 1D vector of Surface pressures [Pa] |
altitude | 1D vector of station altitudes above sea level [m] |
temperature | 1D vector of temperature [K] |
rh | 1D vector of relative humidity [1] |
dewpoint | 1D vector of dewpoint temperature [K] |
void gridpp::set_debug_level | ( | int | level | ) |
Set the verbosity of debug messages.
Use 0 for no messages.s
level | Debug level |
void gridpp::set_omp_threads | ( | int | num | ) |
Set the number of OpenMP threads to use.
Overrides OMP_NUM_THREAD env variable.
num | Number of threads |
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.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues | 2D vector of input values (Yi, Xi) |
elev_gradient | Elevation gradient [input unit/m] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues | 3D vector of input values (E, Yi, Xi) |
elev_gradient | Elevation gradient [input unit/m] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
opoints | Points of downscaled output |
ivalues | 2D vector of input values grid (Yi, Xi) |
elev_gradient | Elevation gradient [input unit/m] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
opoints | Points of downscaled output |
ivalues | 3D vector of input values (E, Yi, Xi) |
elev_gradient | Elevation gradient [input unit/m] |
downscaler | Downscaling method |
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.
igrid | Grid of input (Yi, Xi) |
ogrid | Grid of downscaled output (Yo, Xo) |
ivalues | 2D vector of input values (Yi, Xi) |
num | Number of neighbours to average |
structure | Structure function for determining how similar neighbour gridpoints are |
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 | ) |
Writes a warning message to standard out.
string | Write this 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 | Relative humidity [1] |
vec gridpp::wetbulb | ( | const vec & | temperature, |
const vec & | pressure, | ||
const vec & | relative_humidity | ||
) |
Vector version of wetbulb calculation.
temperature | 1D vector of temperature [K] |
pressure | 1D vector of air pressure [pa] |
relative_humidity | 1D vector of Relative humidity [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 | 1D vector of X-component of wind [any unit] |
ywind | 1D vector of Y-component 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 | 1D vector of X-component of wind [any unit] |
ywind | 1D vector of Y-component of wind [any unit] |
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.
array | 2D vector of input values (Case, Time) |
length | Window length in number of timesteps |
statistic | Statistic to apply to window |
before | If true, make the window end at the particular time. If false, centre it. |
keep_missing | If true, window value will be missing if one or more values in window are missing |
missing_edges | If true put missing values at the edges, where window overshoots the edge |
|
static |
|
static |
Universal Gas Constant [kg*m^2*s^-2/(K*mol)].
|
static |
Universal Gas Constant [J/(kg*K)].
|
static |
Gravitational acceleration [m/s^2].
|
static |
Constant Lapse Rate moist air standard atmosphere [K/m].
|
static |
Molar Mass of Dry Air [kg/mol].
|
static |
Missing value indicator.
|
static |
Missing value indicator in gridpp command-line tool.
|
static |
Mathematical constant pi.
|
static |
Radius of the earth [m].
|
static |
Temperature at surface in standard atmosphere [K].
|
static |
Default value used to fill array in SWIG testing functions.
Not useful for any other purpose.