MeteoIODoc 20241221.207bde49
mio::ProcessingBlock Class Referenceabstract

Detailed Description

The base class for all filters that provides the interface and a few helper methods.

#include <ProcessingBlock.h>

Public Member Functions

virtual ~ProcessingBlock ()
 
virtual void process (const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)=0
 
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
 Should the provided station be skipped in the processing? More...
 
bool noStationsRestrictions () const
 
const std::vector< DateRangegetTimeRestrictions () const
 
bool skipHeight (const double &height) const
 Should the provided height be skipped in the processing? More...
 

Static Public Member Functions

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_specreadCorrections (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 Public Attributes

static const double default_height
 

Protected Member Functions

 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 More...
 

Static Protected Member Functions

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

const std::set< std::string > excluded_stations
 
const std::set< std::string > kept_stations
 
const std::vector< DateRangetime_restrictions
 
std::set< double > included_heights
 
std::set< double > excluded_heights
 
bool all_heights
 
ProcessingProperties properties
 
const std::string block_name
 

Static Protected Attributes

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

◆ ~ProcessingBlock()

virtual mio::ProcessingBlock::~ProcessingBlock ( )
inlinevirtual

◆ ProcessingBlock()

mio::ProcessingBlock::ProcessingBlock ( const std::vector< std::pair< std::string, std::string > > &  vecArgs,
const std::string &  name,
const Config cfg 
)
protected

protected constructor only to be called by children

Member Function Documentation

◆ extract_dbl_vector() [1/2]

void mio::ProcessingBlock::extract_dbl_vector ( const unsigned int &  param,
const std::vector< const MeteoData * > &  ivec,
std::vector< double > &  ovec 
)
staticprotected

◆ extract_dbl_vector() [2/2]

void mio::ProcessingBlock::extract_dbl_vector ( const unsigned int &  param,
const std::vector< MeteoData > &  ivec,
std::vector< double > &  ovec 
)
staticprotected

◆ getName()

std::string mio::ProcessingBlock::getName ( ) const
inline

◆ getProperties()

const ProcessingProperties & mio::ProcessingBlock::getProperties ( ) const
inline

◆ getTimeRestrictions()

const std::vector< DateRange > mio::ProcessingBlock::getTimeRestrictions ( ) const
inline

◆ noStationsRestrictions()

bool mio::ProcessingBlock::noStationsRestrictions ( ) const
inline

◆ process() [1/2]

◆ process() [2/2]

virtual void mio::ProcessingBlock::process ( Date dateStart,
Date dateEnd 
)
inlinevirtual

Reimplemented in mio::TimeLoop.

◆ readCorrections() [1/4]

std::vector< ProcessingBlock::offset_spec > mio::ProcessingBlock::readCorrections ( const std::string &  filter,
const std::string &  filename,
const double &  TZ,
const size_t &  col_idx = 2 
)
static

Read a correction file, ie a file structured as timestamps followed by values on each lines.

Parameters
[in]filterCalling filter name for error reporting
[in]filenamefile and path to open and read the data from
[in]TZdefault timezone for the timestamps
[in]col_idxcolumn to read the data from (column 1 contains the timestamps)
Returns
a vector of <Date, value> as read from the provided file

◆ readCorrections() [2/4]

std::vector< double > mio::ProcessingBlock::readCorrections ( const std::string &  filter,
const std::string &  filename,
const size_t &  col_idx,
const char &  c_type,
const double &  init 
)
static

Read a correction file applicable to repeating time period.

This reads corrections to apply to repeating time periods, such as hours, dyas, months or years. Not all values must be provided as a default initial value is set. Depending on the time period, a check on the index range is performed (hours must be <=24, days <=366, months <=12, years have no maximum).

Parameters
[in]filterCalling filter name for error reporting
[in]filenamefile and path to open and read the data from
[in]col_idxcolumn to read the data from (column 1 contains the timestamps)
[in]c_typeexpected time period
[in]initdefault value to initalize the results
Returns
a vector of corrections as read from the provided file, the indices matching the indices of the chosen time period

◆ readCorrections() [3/4]

void mio::ProcessingBlock::readCorrections ( const std::string &  filter,
const std::string &  filename,
std::vector< double > &  X,
std::vector< double > &  Y 
)
static

Read a data file structured as X Y value on each lines.

Parameters
[in]filterCalling filter name for error reporting
[in]filenamefile and path to open and read the data from
[out]Xvector of X values
[out]Yvector of Y values

◆ readCorrections() [4/4]

void mio::ProcessingBlock::readCorrections ( const std::string &  filter,
const std::string &  filename,
std::vector< double > &  X,
std::vector< double > &  Y1,
std::vector< double > &  Y2 
)
static

Read a data file structured as X Y1 Y2 value on each lines.

Parameters
[in]filterCalling filter name for error reporting
[in]filenamefile and path to open and read the data from
[out]Xvector of X values
[out]Y1vector of Y1 values
[out]Y2vector of Y2 values

◆ readDates()

std::map< std::string, std::vector< DateRange > > mio::ProcessingBlock::readDates ( const std::string &  filter,
const std::string &  filename,
const double &  TZ 
)
static

Read a list of date ranges by stationIDs from a file.

Each station ID read in the provided file is attributed a list fo date ranges. For example, the file to read the data from can contain:

*WFJ 2015-11-10T06:00
*WFJ 2015-12-25T01:00 2015-12-27T13:30

All these time ranges will populate a vector that will be mapped to the "*WFJ" station ID.

Parameters
[in]filterCalling filter name for error reporting
[in]filenamefile and path to open and read the data from
[in]TZdefault timezone for the timestamps
Returns
a map of <stationID, std::vector<DateRange>> as read from the provided file

◆ skipHeight()

bool mio::ProcessingBlock::skipHeight ( const double &  height) const

Should the provided height be skipped in the processing?

Parameters
[in]heightheight to test
Returns
true if the startion should be skipped, false otherwise

◆ skipStation()

bool mio::ProcessingBlock::skipStation ( const std::string &  station_id) const

Should the provided station be skipped in the processing?

Parameters
[in]station_idstationID to test
Returns
true if the startion should be skipped, false otherwise

◆ toString()

const std::string mio::ProcessingBlock::toString ( ) const

Member Data Documentation

◆ all_heights

bool mio::ProcessingBlock::all_heights
protected

◆ block_name

const std::string mio::ProcessingBlock::block_name
protected

◆ default_height

const double mio::ProcessingBlock::default_height
static

◆ excluded_heights

std::set<double> mio::ProcessingBlock::excluded_heights
protected

◆ excluded_stations

const std::set<std::string> mio::ProcessingBlock::excluded_stations
protected

◆ included_heights

std::set<double> mio::ProcessingBlock::included_heights
protected

◆ kept_stations

const std::set<std::string> mio::ProcessingBlock::kept_stations
protected

◆ properties

ProcessingProperties mio::ProcessingBlock::properties
protected

◆ snow_albedo

const double mio::ProcessingBlock::snow_albedo = .85
staticprotected

◆ snow_thresh

const double mio::ProcessingBlock::snow_thresh = .1
staticprotected

parametrize the albedo from HS

◆ soil_albedo

const double mio::ProcessingBlock::soil_albedo = .23
staticprotected

◆ time_restrictions

const std::vector<DateRange> mio::ProcessingBlock::time_restrictions
protected

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