MeteoIODoc  MeteoIODoc-2.9.0
mio::ProcMult Class Reference

Detailed Description

Multiply values.

This multiplies all values by a given factor. 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 factors 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 factor in the second column (whitespace delimited). Comments following the same syntax as in the ini file are accepted, missing indices are treated as 1. It is also possible to multiply by a random noise.

It takes the following arguments:

  • TYPE: either CST (multiply by a constant) or FILE (multiply by values form a given file) or NOISE (multiply by 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.
Note
When multiplying the input signal by the noise, the range is interpreted as a fraction. For example, to modify the input by +/-10%, select "uniform" with "0.1" as a range.
PSUM::filter1 = mult
PSUM::arg1::type = CST
PSUM::arg1::cst = 2.5
HS::filter1 = mult
HS::arg1::type = FILE
HS::arg1::period = daily
HS::arg1::corrections = input/HS_corr.dat
VW::filter1 = add
VW::arg1::type = NOISE
VW::arg1::distribution = uniform
VW::arg1::range = 0.1

Example of correction file (monthly correction, August will receive a correction of 1):

01 0.440593
02 0.815111
03 0.475562
04 0.674975
05 0.700086
06 0.886783
07 1.70733
09 1.26533
10 0.577152
11 0.394095
12 0.347335

#include <ProcMult.h>

Public Member Functions

 ProcMult (const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const std::string &i_root_path)
 
virtual void process (const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
 
- Public Member Functions inherited from mio::ProcAdd
 ProcAdd (const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const std::string &i_root_path)
 
- Public Member Functions inherited from mio::ProcessingBlock
virtual ~ProcessingBlock ()
 
virtual void process (Date &dateStart, Date &dateEnd)
 
std::string getName () const
 
const ProcessingPropertiesgetProperties () const
 
const std::string toString () const
 
bool skipStation (const std::string &station_id) const
 
bool noStationsRestrictions () const
 

Protected Member Functions

virtual void uniform_noise (const unsigned int &param, std::vector< MeteoData > &ovec) const
 
virtual void normal_noise (const unsigned int &param, std::vector< MeteoData > &ovec) const
 
- Protected Member Functions inherited from mio::ProcAdd
void parse_args (const std::vector< std::pair< std::string, std::string > > &vecArgs)
 
- Protected Member Functions inherited from mio::ProcessingBlock
 ProcessingBlock (const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name)
 protected constructor only to be called by children More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mio::ProcessingBlock
static void readCorrections (const std::string &filter, const std::string &filename, std::vector< double > &X, std::vector< double > &Y)
 
static void readCorrections (const std::string &filter, const std::string &filename, std::vector< double > &X, std::vector< double > &Y1, std::vector< double > &Y2)
 
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)
 
static std::vector< offset_specreadCorrections (const std::string &filter, const std::string &filename, const double &TZ, const size_t &col_idx=2)
 
static std::map< std::string, std::vector< dates_range > > readDates (const std::string &filter, const std::string &filename, const double &TZ)
 
static std::set< std::string > initStationSet (const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &keyword)
 
- Static Protected Member Functions inherited from mio::ProcessingBlock
static void extract_dbl_vector (const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< double > &ovec)
 
static void extract_dbl_vector (const unsigned int &param, const std::vector< const MeteoData *> &ivec, std::vector< double > &ovec)
 
- Protected Attributes inherited from mio::ProcAdd
std::vector< double > vecCorrections
 
std::string root_path
 
double correction
 
double range
 
char type
 
char distribution
 
char period
 
- Protected Attributes inherited from mio::ProcessingBlock
const std::set< std::string > excluded_stations
 
const std::set< std::string > kept_stations
 
ProcessingProperties properties
 
const std::string block_name
 
- Static Protected Attributes inherited from mio::ProcessingBlock
static const double soil_albedo = .23
 
static const double snow_albedo = .85
 
static const double snow_thresh = .1
 parametrize the albedo from HS More...
 

Constructor & Destructor Documentation

◆ ProcMult()

mio::ProcMult::ProcMult ( const std::vector< std::pair< std::string, std::string > > &  vecArgs,
const std::string &  name,
const std::string &  i_root_path 
)

Member Function Documentation

◆ normal_noise()

void mio::ProcMult::normal_noise ( const unsigned int &  param,
std::vector< MeteoData > &  ovec 
) const
protectedvirtual

Reimplemented from mio::ProcAdd.

◆ process()

void mio::ProcMult::process ( const unsigned int &  param,
const std::vector< MeteoData > &  ivec,
std::vector< MeteoData > &  ovec 
)
virtual

Reimplemented from mio::ProcAdd.

◆ uniform_noise()

void mio::ProcMult::uniform_noise ( const unsigned int &  param,
std::vector< MeteoData > &  ovec 
) const
protectedvirtual

Reimplemented from mio::ProcAdd.


The documentation for this class was generated from the following files: