19#ifndef PROCESSINGBLOCK_H
20#define PROCESSINGBLOCK_H
31 #pragma warning(disable:4512)
38 typedef enum PROC_STAGE {
none,
70 typedef struct OFFSET_SPEC {
72 OFFSET_SPEC(
const Date& d1,
const double& i_value) : date(d1), value(i_value) {}
83 virtual void process(
const unsigned int& param,
const std::vector<MeteoData>& ivec,
84 std::vector<MeteoData>& ovec) = 0;
92 bool skipStation(
const std::string& station_id)
const;
96 static void readCorrections(
const std::string& filter,
const std::string& filename, std::vector<double> &X, std::vector<double> &Y);
97 static void readCorrections(
const std::string& filter,
const std::string& filename, std::vector<double> &X, std::vector<double> &Y1, std::vector<double> &Y2);
98 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);
99 static std::vector<offset_spec>
readCorrections(
const std::string& filter,
const std::string& filename,
const double& TZ,
const size_t& col_idx=2);
100 static std::map< std::string, std::vector<DateRange> >
readDates(
const std::string& filter,
const std::string& filename,
const double& TZ);
103 ProcessingBlock(
const std::vector< std::pair<std::string, std::string> >& vecArgs,
const std::string& name,
const Config& cfg);
105 static void extract_dbl_vector(
const unsigned int& param,
const std::vector<MeteoData>& ivec,
106 std::vector<double>& ovec);
107 static void extract_dbl_vector(
const unsigned int& param,
const std::vector<const MeteoData*>& ivec,
108 std::vector<double>& ovec);
120 static ProcessingBlock*
getBlock(
const std::string& blockname,
const std::vector< std::pair<std::string, std::string> >& vecArgs,
const Config& cfg);
#define AT
Definition: IOExceptions.h:28
Definition: ProcessingBlock.h:118
static ProcessingBlock * getBlock(const std::string &blockname, const std::vector< std::pair< std::string, std::string > > &vecArgs, const Config &cfg)
Definition: ProcessingBlock.cc:178
static ProcessingBlock * getTimeBlock(const std::string &blockname, const std::vector< std::pair< std::string, std::string > > &vecArgs, const Config &cfg)
Definition: ProcessingBlock.cc:266
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
thrown when encountered an unexpected function's argument (e.g. bad index, bad or missing parameter n...
Definition: IOExceptions.h:130
The base class for all filters that provides the interface and a few helper methods.
Definition: ProcessingBlock.h:67
bool skipStation(const std::string &station_id) const
Should the provided station be skipped in the processing?
Definition: ProcessingBlock.cc:295
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.
Definition: ProcessingBlock.cc:590
static const double snow_thresh
parametrize the albedo from HS
Definition: ProcessingBlock.h:115
std::string getName() const
Definition: ProcessingBlock.h:89
virtual void process(const unsigned int ¶m, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)=0
const std::set< std::string > excluded_stations
Definition: ProcessingBlock.h:110
static const double soil_albedo
Definition: ProcessingBlock.h:115
const ProcessingProperties & getProperties() const
Definition: ProcessingBlock.h:90
virtual void process(Date &dateStart, Date &dateEnd)
Definition: ProcessingBlock.h:87
virtual ~ProcessingBlock()
Definition: ProcessingBlock.h:81
const std::vector< DateRange > time_restrictions
Definition: ProcessingBlock.h:111
ProcessingProperties properties
Definition: ProcessingBlock.h:112
static void extract_dbl_vector(const unsigned int ¶m, const std::vector< MeteoData > &ivec, std::vector< double > &ovec)
Definition: ProcessingBlock.cc:659
static const double snow_albedo
Definition: ProcessingBlock.h:115
ProcessingBlock(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
protected constructor only to be called by children
Definition: ProcessingBlock.cc:286
bool noStationsRestrictions() const
Definition: ProcessingBlock.h:93
const std::set< std::string > kept_stations
Definition: ProcessingBlock.h:110
const std::string block_name
Definition: ProcessingBlock.h:113
const std::vector< DateRange > getTimeRestrictions() const
Definition: ProcessingBlock.h:94
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.
Definition: ProcessingBlock.cc:310
const std::string toString() const
Definition: ProcessingBlock.cc:677
Definition: ProcessingBlock.h:36
proc_stage stage
Definition: ProcessingBlock.h:60
Duration time_after
Definition: ProcessingBlock.h:55
ProcessingProperties(const Duration &t_before, const Duration &t_after, const size_t &pt_before, const size_t &pt_after, const proc_stage &i_stage)
Definition: ProcessingBlock.h:49
Duration time_before
Definition: ProcessingBlock.h:54
const std::string toString() const
Definition: ProcessingBlock.cc:685
size_t points_after
Definition: ProcessingBlock.h:58
ProcessingProperties()
Definition: ProcessingBlock.h:45
size_t points_before
Definition: ProcessingBlock.h:57
proc_stage
Definition: ProcessingBlock.h:38
@ second
activate at second stage
Definition: ProcessingBlock.h:40
@ none
never activate this block
Definition: ProcessingBlock.h:38
@ first
activate at first stage
Definition: ProcessingBlock.h:39
@ both
activate at both first and second stage
Definition: ProcessingBlock.h:41
Definition: ProcessingBlock.h:70
bool operator<(const OFFSET_SPEC &a) const
Definition: ProcessingBlock.h:73
Date date
Definition: ProcessingBlock.h:77
double value
Definition: ProcessingBlock.h:78
OFFSET_SPEC(const Date &d1, const double &i_value)
Definition: ProcessingBlock.h:72
OFFSET_SPEC()
Definition: ProcessingBlock.h:71