Helper functions. More...
Functions | |
vec | calc_even_quantiles (const vec &values, int num) |
Get reasonably spaced quantiles from a vector of values, ignoring duplicate values but including the first number after duplicated values. More... | |
float | calc_quantile (const vec &array, float quantile) |
vec | calc_quantile (const vec2 &array, float quantile=gridpp::MV) |
float | calc_statistic (const vec &array, Statistic statistic) |
vec | calc_statistic (const vec2 &array, Statistic statistic) |
double | clock () |
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) |
void | debug (std::string string) |
void | error (std::string string) |
int | get_lower_index (float iX, const std::vector< float > &iValues) |
Find the index in a vector that is equal or just below a value. More... | |
int | get_upper_index (float iX, const std::vector< float > &iValues) |
Find the index in a vector that is equal or just above a value. More... | |
vec2 | init_vec2 (int Y, int X, float value=gridpp::MV) |
Initialize a vector of size Y, X, with a given value. More... | |
float | interpolate (float x, const std::vector< float > &iX, const std::vector< float > &iY) |
Piecewise linear interpolation.o If x is outside the range of iX, then the min/max value of iY is used. More... | |
bool | is_valid (float value) |
void | not_implemented_error () |
int | num_missing_values (const vec2 &iArray) |
float * | test_array (float *v, int n) |
Special function whose presense is needed for SWIG. More... | |
ivec2 | test_ivec2_output () |
int | test_ivec_input (const ivec &input) |
Testing function for 1D input vector. More... | |
ivec | test_ivec_output () |
Testing function for 1D output vector. More... | |
float | test_vec2_input (const vec2 &input) |
Testing function for 2D input vector. More... | |
vec2 | test_vec2_output () |
Testing function for 2D output vector. More... | |
float | test_vec3_input (const vec3 &input) |
Testing function for 3D input vector. More... | |
vec3 | test_vec3_output () |
Testing function for 3D output vector. More... | |
float | test_vec_input (const vec &input) |
Testing function for 1D input vector. More... | |
vec | test_vec_output () |
Testing function for 1D output vector. More... | |
void | warning (std::string string) |
Helper functions.
Get reasonably spaced quantiles from a vector of values, ignoring duplicate values but including the first number after duplicated values.
Include the lowest and highest values.
values | vector of values (unsorted, and no invalid values) |
num | number of thresholds to get |
float gridpp::util::calc_quantile | ( | const vec & | array, |
float | quantile | ||
) |
vec gridpp::util::calc_quantile | ( | const vec2 & | array, |
float | quantile = gridpp::MV |
||
) |
float gridpp::util::calc_statistic | ( | const vec & | array, |
gridpp::Statistic | statistic | ||
) |
vec gridpp::util::calc_statistic | ( | const vec2 & | array, |
gridpp::Statistic | statistic | ||
) |
double gridpp::util::clock | ( | ) |
Check if the grid is the same size as the 2D vector.
void gridpp::util::debug | ( | std::string | string | ) |
void gridpp::util::error | ( | std::string | string | ) |
int gridpp::util::get_lower_index | ( | float | iX, |
const std::vector< float > & | iValues | ||
) |
Find the index in a vector that is equal or just below a value.
iX | Lookup value |
iValues | Lookup vector. Must be sorted. |
int gridpp::util::get_upper_index | ( | float | iX, |
const std::vector< float > & | iValues | ||
) |
Find the index in a vector that is equal or just above a value.
iX | Lookup value |
iValues | Lookup vector. Must be sorted. |
vec2 gridpp::util::init_vec2 | ( | int | Y, |
int | X, | ||
float | value = gridpp::MV |
||
) |
Initialize a vector of size Y, X, with a given value.
float gridpp::util::interpolate | ( | float | x, |
const std::vector< float > & | iX, | ||
const std::vector< float > & | iY | ||
) |
Piecewise linear interpolation.o If x is outside the range of iX, then the min/max value of iY is used.
x | Interpolation to this point |
iX | Vector of x-axis values. Vector must be sorted. |
iY | Vector of y-axis values corresponding to iX. |
bool gridpp::util::is_valid | ( | float | value | ) |
void gridpp::util::not_implemented_error | ( | ) |
int gridpp::util::num_missing_values | ( | const vec2 & | iArray | ) |
float * gridpp::util::test_array | ( | float * | v, |
int | n | ||
) |
Special function whose presense is needed for SWIG.
ivec2 gridpp::util::test_ivec2_output | ( | ) |
int gridpp::util::test_ivec_input | ( | const ivec & | input | ) |
Testing function for 1D input vector.
ivec gridpp::util::test_ivec_output | ( | ) |
Testing function for 1D output vector.
float gridpp::util::test_vec2_input | ( | const vec2 & | input | ) |
Testing function for 2D input vector.
vec2 gridpp::util::test_vec2_output | ( | ) |
Testing function for 2D output vector.
float gridpp::util::test_vec3_input | ( | const vec3 & | input | ) |
Testing function for 3D input vector.
vec3 gridpp::util::test_vec3_output | ( | ) |
Testing function for 3D output vector.
float gridpp::util::test_vec_input | ( | const vec & | input | ) |
Testing function for 1D input vector.
vec gridpp::util::test_vec_output | ( | ) |
Testing function for 1D output vector.
void gridpp::util::warning | ( | std::string | string | ) |