Gridpp 0.4.2
A post-processing library for gridded weather forecasts
Functions
gridpp::util Namespace Reference

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)
 

Detailed Description

Helper functions.

Function Documentation

◆ calc_even_quantiles()

vec gridpp::util::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.

Include the lowest and highest values.

Parameters
valuesvector of values (unsorted, and no invalid values)
numnumber of thresholds to get

◆ calc_quantile() [1/2]

float gridpp::util::calc_quantile ( const vec array,
float  quantile 
)

◆ calc_quantile() [2/2]

vec gridpp::util::calc_quantile ( const vec2 array,
float  quantile = gridpp::MV 
)

◆ calc_statistic() [1/2]

float gridpp::util::calc_statistic ( const vec array,
gridpp::Statistic  statistic 
)

◆ calc_statistic() [2/2]

vec gridpp::util::calc_statistic ( const vec2 array,
gridpp::Statistic  statistic 
)

◆ clock()

double gridpp::util::clock ( )

◆ compatible_size() [1/2]

bool gridpp::util::compatible_size ( const Grid grid,
const vec2 v 
)

Check if the grid is the same size as the 2D vector.

◆ compatible_size() [2/2]

bool gridpp::util::compatible_size ( const Grid grid,
const vec3 v 
)

◆ debug()

void gridpp::util::debug ( std::string  string)

◆ error()

void gridpp::util::error ( std::string  string)

◆ get_lower_index()

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.

Parameters
iXLookup value
iValuesLookup vector. Must be sorted.
Returns
The index into iValues that is equal or just below iX

◆ get_upper_index()

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.

Parameters
iXLookup value
iValuesLookup vector. Must be sorted.
Returns
The index into iValues that is equal or just above iX

◆ init_vec2()

vec2 gridpp::util::init_vec2 ( int  Y,
int  X,
float  value = gridpp::MV 
)

Initialize a vector of size Y, X, with a given value.

◆ interpolate()

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.

Parameters
xInterpolation to this point
iXVector of x-axis values. Vector must be sorted.
iYVector of y-axis values corresponding to iX.
Returns
Y value corresponding to x

◆ is_valid()

bool gridpp::util::is_valid ( float  value)

◆ not_implemented_error()

void gridpp::util::not_implemented_error ( )

◆ num_missing_values()

int gridpp::util::num_missing_values ( const vec2 iArray)

◆ test_array()

float * gridpp::util::test_array ( float *  v,
int  n 
)

Special function whose presense is needed for SWIG.

◆ test_ivec2_output()

ivec2 gridpp::util::test_ivec2_output ( )

◆ test_ivec_input()

int gridpp::util::test_ivec_input ( const ivec input)

Testing function for 1D input vector.

◆ test_ivec_output()

ivec gridpp::util::test_ivec_output ( )

Testing function for 1D output vector.

◆ test_vec2_input()

float gridpp::util::test_vec2_input ( const vec2 input)

Testing function for 2D input vector.

◆ test_vec2_output()

vec2 gridpp::util::test_vec2_output ( )

Testing function for 2D output vector.

◆ test_vec3_input()

float gridpp::util::test_vec3_input ( const vec3 input)

Testing function for 3D input vector.

◆ test_vec3_output()

vec3 gridpp::util::test_vec3_output ( )

Testing function for 3D output vector.

◆ test_vec_input()

float gridpp::util::test_vec_input ( const vec input)

Testing function for 1D input vector.

◆ test_vec_output()

vec gridpp::util::test_vec_output ( )

Testing function for 1D output vector.

◆ warning()

void gridpp::util::warning ( std::string  string)