MeteoIODoc 20241005.2ccf54a9
Resampling overview

The resampling infrastructure is described in ResamplingAlgorithms (for its API). The goal of this page is to give an overview of the available resampling algorithms and their usage.

Resampling section

The resampling is specified for each parameter in the [Interpolations1D] section. This section contains a list of the various meteo parameters (either from the list of standard parameter names or any other name of your choice) with their associated choice of resampling algorithm stacks and optional parameters. If a meteo parameter is not listed in this section, a linear resampling would be assumed. The Resampling is done by using a stack of resampling algorithms, with optional specifications of the maximum data gap that the respective algorithm should be used for. (The default for the maximum gap size is -999 = internal nodata value, meaning that the algorithm should be used for all gaps).

NEW: The arguments for the resampling algorithms are not given by PARAM::ALGO_NAME::ARGUMENT anymore but by PARAM::ARG#::ARGUMENT for the resampling algorithm number #. This allows to repeat the same algorithm with different parameters for the same meteo parameter.

NEW: Parameter heights will be accounted for (given with ...) parameters at different heights will be treated with the same algorithm.

An example of such section is given below:

[Interpolations1D]
MAX_GAP_SIZE = 86400
TA::RESAMPLE1 = linear
RH::RESAMPLE1 = linear
RH::ARG1::MAX_GAP_SIZE = 86400 # 1 day in seconds
VW::resample1 = nearest
VW::ARG1::extrapolate = true
VW::ARG1::max_gap_size = 3600
VW::resample2 = nearest
VW::ARG2::extrapolate = false
VW::ARG2::max_gap_size = 86400
PSUM::resample1 = accumulate
PSUM::arg1::period = 3600
static double linear(double x, const std::vector< double > &params)
Definition: DataEditingAlgorithms.cc:1154

Most of the resampling algorithms allow you to define per-meteo parameter and per-algorithm the MAX_GAP_SIZE. Otherwise, the section's MAX_GAP_SIZE is used as default maximum gap size. This represents the biggest gap that can be interpolated (in seconds). Therefore if two valid points are less than MAX_GAP_SIZE seconds apart, points in between will be interpolated. If they are further apart, all points in between will remain IOUtils::nodata. If using the "extrapolate" optional argument, points at MAX_GAP_SIZE distance of only one valid point will be extrapolated, otherwise they will remain IOUtils::nodata. Please keep in mind that allowing extrapolated values can lead to grossly out of range data: using the slope between two hourly measurements to extrapolate a point 10 days ahead is obviously risky!

By default, MAX_GAP_SIZE is set to 2 days. This key has a potentially large impact on run time/performance.

Available Resampling Algorithms

Several algorithms for the resampling are implemented:

  • none: do not perform resampling, see NoResampling
  • nearest: nearest neighbor data resampling, see NearestNeighbour
  • linear: linear data resampling, see LinearResampling
  • accumulate: data re-accumulation as suitable for precipitations, see Accumulate
  • solar: resample solar radiation by interpolating an atmospheric loss factor, see Solar
  • daily_solar: generate solar radiation (ISWR or RSWR) from daily sums, see Daily_solar
  • daily_avg: generate a sinusoidal variation around the measurement taken as daily average and of a given amplitude, see DailyAverage
  • ARIMA: resample using the ARIMA model, see ARIMAResampling
Note
By default a linear resampling will be performed. It is possible to turn off all resampling by setting the Enable_Resampling key to false in the [Interpolations1D] section.