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;
97 static void readCorrections(
const std::string& filter,
const std::string& filename, std::vector<double> &X, std::vector<double> &Y);
98 static void readCorrections(
const std::string& filter,
const std::string& filename, std::vector<double> &X, std::vector<double> &Y1, std::vector<double> &Y2);
99 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);
100 static std::vector<offset_spec>
readCorrections(
const std::string& filter,
const std::string& filename,
const double& TZ,
const size_t& col_idx=2);
101 static std::map< std::string, std::vector<DateRange> >
readDates(
const std::string& filter,
const std::string& filename,
const double& TZ);
107 ProcessingBlock(
const std::vector< std::pair<std::string, std::string> >& vecArgs,
const std::string& name,
const Config& cfg);
109 static void extract_dbl_vector(
const unsigned int& param,
const std::vector<MeteoData>& ivec,
110 std::vector<double>& ovec);
111 static void extract_dbl_vector(
const unsigned int& param,
const std::vector<const MeteoData*>& ivec,
112 std::vector<double>& ovec);
124 void initHeightRestrictions(
const std::vector<std::pair<std::string, std::string>> vecArgs);
129 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:127
static ProcessingBlock * getBlock(const std::string &blockname, const std::vector< std::pair< std::string, std::string > > &vecArgs, const Config &cfg)
Definition: ProcessingBlock.cc:197
static ProcessingBlock * getTimeBlock(const std::string &blockname, const std::vector< std::pair< std::string, std::string > > &vecArgs, const Config &cfg)
Definition: ProcessingBlock.cc:287
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
static const double default_height
Definition: ProcessingBlock.h:103
bool skipStation(const std::string &station_id) const
Should the provided station be skipped in the processing?
Definition: ProcessingBlock.cc:370
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:680
static const double snow_thresh
parametrize the albedo from HS
Definition: ProcessingBlock.h:121
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
bool skipHeight(const double &height) const
Should the provided height be skipped in the processing?
Definition: ProcessingBlock.cc:383
const std::set< std::string > excluded_stations
Definition: ProcessingBlock.h:114
static const double soil_albedo
Definition: ProcessingBlock.h:121
std::set< double > excluded_heights
Definition: ProcessingBlock.h:116
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:115
ProcessingProperties properties
Definition: ProcessingBlock.h:118
static void extract_dbl_vector(const unsigned int ¶m, const std::vector< MeteoData > &ivec, std::vector< double > &ovec)
Definition: ProcessingBlock.cc:749
static const double snow_albedo
Definition: ProcessingBlock.h:121
std::set< double > included_heights
Definition: ProcessingBlock.h:116
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:307
bool all_heights
Definition: ProcessingBlock.h:117
bool noStationsRestrictions() const
Definition: ProcessingBlock.h:93
const std::set< std::string > kept_stations
Definition: ProcessingBlock.h:114
const std::string block_name
Definition: ProcessingBlock.h:119
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:400
const std::string toString() const
Definition: ProcessingBlock.cc:767
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:775
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