Add an offset to the values.
This adds to all values a given offset. Either a fixed value is given as single argument or a period (hourly/daily/monthly) as well as a filename (and absolute or relative path) containing the offsets to apply. This file must contain in the first column the indices (months from 1 to 12 or days from 1 to 366 or hours from 0 to 23) and the matching offset in the second column (whitespace delimited). Comments following the same syntax as in the ini file are accepted, missing indices are treated as 0. It is also possible to add random noise.
It takes the following arguments:
- TYPE: either CST (add a constant) or FILE (add values form a given file) or NOISE (add random values).
- when adding a constant:
- CST: a constant to add to the data (optional);
- when adding corrections from a file:
- PERIOD: when reading corrections from a file, the period over which the corrections apply, either HOURLY, DAILY or MONTHLY (optional);
- CORRECTIONS: the file and path containing the corrections to apply (mandatory when using PERIOD);
- COLUMN: when using a corrections file, which column should be used if this is a multi-column file (knowing that the indices is column 1. Default: 2).
- when adding noise:
- RANGE: the scaling factor to apply to the random values (see below);
- DISTRIBUTION: to specify the random numbers distribution as either
- uniform: the range represents the maximum amplitude of the noise;
- normal: the range represents the standard deviation of the noise.
TA::filter1 = add
TA::arg1::type = CST
TA::arg1::cst = 2.5
TSG::filter1 = add
TSG::arg1::type = FILE
TSG::arg1::period = daily
TSG::arg1::corrections = input/TSG_corr.dat
TSS::filter1 = add
TSS::arg1::type = NOISE
TSS::arg1::distribution = normal
TSS::arg1::range = 5
Example of correction file (monthly correction, December will receive a correction of 0):
01 -0.375
02 -1.932
03 -4.304
04 -2.449
05 -1.629
06 -1.734
07 -2.414
09 -1.289
10 -1.086
11 -0.769
|
static void | readCorrections (const std::string &filter, const std::string &filename, std::vector< double > &X, std::vector< double > &Y) |
| Read a data file structured as X Y value on each lines. More...
|
|
static void | readCorrections (const std::string &filter, const std::string &filename, std::vector< double > &X, std::vector< double > &Y1, std::vector< double > &Y2) |
| Read a data file structured as X Y1 Y2 value on each lines. More...
|
|
static std::vector< double > | readCorrections (const std::string &filter, const std::string &filename, const size_t &col_idx, const char &c_type, const double &init) |
| Read a correction file applicable to repeating time period. More...
|
|
static std::vector< offset_spec > | readCorrections (const std::string &filter, const std::string &filename, const double &TZ, const size_t &col_idx=2) |
| Read a correction file, ie a file structured as timestamps followed by values on each lines. More...
|
|
static std::map< std::string, std::vector< DateRange > > | readDates (const std::string &filter, const std::string &filename, const double &TZ) |
| Read a list of date ranges by stationIDs from a file. More...
|
|
static void | extract_dbl_vector (const unsigned int ¶m, const std::vector< MeteoData > &ivec, std::vector< double > &ovec) |
|
static void | extract_dbl_vector (const unsigned int ¶m, const std::vector< const MeteoData * > &ivec, std::vector< double > &ovec) |
|
static const double | soil_albedo = .23 |
|
static const double | snow_albedo = .85 |
|
static const double | snow_thresh = .1 |
| parametrize the albedo from HS More...
|
|