MeteoIODoc 20240418.14865e3c
mio::EditingBlock Class Reference

Detailed Description

Base class for DataEditing algorithms.

#include <DataEditingAlgorithms.h>

Public Member Functions

 EditingBlock (const std::string &i_stationID, const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
 
virtual ~EditingBlock ()
 
virtual void editTimeSeries (std::vector< METEO_SET > &vecMeteo)
 Apply this editing block. More...
 
virtual void editTimeSeries (STATIONS_SET &vecStation)
 Apply this editing block to the StationData. More...
 
virtual std::set< std::string > requiredIDs () const
 Get the station IDs this editing block depends on for this station. More...
 
virtual std::set< std::string > providedIDs () const
 Get the station IDs this editing block provides based on this station. More...
 
virtual std::set< std::string > purgeIDs () const
 Get the station IDs to purge after using them for this station ID. More...
 
const std::string toString () const
 

Protected Member Functions

std::string getName () const
 
bool skipStation (const std::vector< MeteoData > &vecMeteo) const
 Return true if this station ID should be skipped. More...
 
METEO_SET timeFilterFromStation (const METEO_SET &vecMeteo) const
 Prepare a station that will be merged in case of time restrictions. More...
 

Static Protected Member Functions

static std::set< std::string > initStationSet (const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &keyword)
 

Protected Attributes

const std::set< std::string > excluded_stations
 
const std::set< std::string > kept_stations
 
const std::vector< DateRangetime_restrictions
 
const std::string stationID
 
const std::string block_name
 

Constructor & Destructor Documentation

◆ EditingBlock()

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

◆ ~EditingBlock()

virtual mio::EditingBlock::~EditingBlock ( )
inlinevirtual

Member Function Documentation

◆ editTimeSeries() [1/2]

virtual void mio::EditingBlock::editTimeSeries ( STATIONS_SET vecStation)
inlinevirtual

Apply this editing block to the StationData.

This applies the editing block for its station that has been declared in the constructor on the provided StationData timeseries.

Parameters
vecStationStationData timeseries for all stations

Reimplemented in mio::EditingMerge, mio::EditingAutoMerge, and mio::EditingMetadata.

◆ editTimeSeries() [2/2]

virtual void mio::EditingBlock::editTimeSeries ( std::vector< METEO_SET > &  vecMeteo)
inlinevirtual

Apply this editing block.

This applies the editing block for its station that has been declared in the constructor on the provided MeteoData timeseries.

Parameters
vecMeteoMeteoData timeseries for all stations

Reimplemented in mio::EditingSwap, mio::EditingRename, mio::EditingExclude, mio::EditingKeep, mio::EditingMerge, mio::EditingAutoMerge, mio::EditingCopy, mio::EditingCreate, mio::EditingMetadata, and mio::EditingRegFill.

◆ getName()

std::string mio::EditingBlock::getName ( ) const
inlineprotected

◆ initStationSet()

std::set< std::string > mio::EditingBlock::initStationSet ( const std::vector< std::pair< std::string, std::string > > &  vecArgs,
const std::string &  keyword 
)
staticprotected

◆ providedIDs()

virtual std::set< std::string > mio::EditingBlock::providedIDs ( ) const
inlinevirtual

Get the station IDs this editing block provides based on this station.

Returns
a set of station IDs it provides

Reimplemented in mio::EditingMetadata.

◆ purgeIDs()

virtual std::set< std::string > mio::EditingBlock::purgeIDs ( ) const
inlinevirtual

Get the station IDs to purge after using them for this station ID.

Returns
a set of station IDs to purge after processing

◆ requiredIDs()

virtual std::set< std::string > mio::EditingBlock::requiredIDs ( ) const
inlinevirtual

Get the station IDs this editing block depends on for this station.

Returns
a set of station IDs it depends on

Reimplemented in mio::EditingMerge.

◆ skipStation()

bool mio::EditingBlock::skipStation ( const std::vector< MeteoData > &  vecMeteo) const
protected

Return true if this station ID should be skipped.

This is based on the comparison between the current station ID and the one this EditingBlock has been configured for as well as the "only" or "exclude" arguments provided by the user in the configuration file. It also checks if the mete timeseries is empty or not.

Parameters
[in]vecMeteotimeseries for the station to inquire for
Returns
true (yes, skip this station ID) or false (please, process this station ID)

◆ timeFilterFromStation()

METEO_SET mio::EditingBlock::timeFilterFromStation ( const METEO_SET vecMeteo) const
protected

Prepare a station that will be merged in case of time restrictions.

In order to apply time restrictions for merges, the easiest is to filter the "from" stations, one by one, to only contain data within the time restrictions periods. Then any merge type works as intented and the process is not too expensive.

Note
this method is only supposed to be called when !time_restrictions.empty()
Parameters
[in]vecMeteotimeseries of the station that provides the data on the from side of merge
Returns
timeseries of the "from" station only containing data in the time restrictions periods

◆ toString()

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

Member Data Documentation

◆ block_name

const std::string mio::EditingBlock::block_name
protected

◆ excluded_stations

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

◆ kept_stations

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

◆ stationID

const std::string mio::EditingBlock::stationID
protected

◆ time_restrictions

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

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