MeteoIODoc 20240417.14865e3c
mio::EditingMerge Class Reference

Detailed Description

MERGE input editing command.

It is possible to merge different data sets together, with the MERGE command. This is useful, for example, to provide measurements from different stations that actually share the same measurement location or to build "composite" station from multiple real stations (in this case, using EXCLUDE and/or KEEP commands to fine tune how the composite station(s) is/are built). It is also possible to restrict which parameters are to be merged with the PARAMS keyword (providing a space-delimited list of parameters).

Please note that the order of declaration defines the priority (ie the first station that has a value for a given parameter has priority). Please also note that which timestamps will be merged depends on the chosen merge strategy with the MERGE_STRATEGY option (see MeteoData::Merge_Type, by default it is MeteoData::EXPAND_MERGE). The handling of merge conflicts can be configured with the MERGE_CONFLICTS optional argument (see MeteoData::Merge_Conflicts, by default it is MeteoData::CONFLICTS_PRIORITY_FIRST). Furthermore, a station can be merged into multiple other stations, but circular dependencies are prohibited (and checked for).

[Input]
METEO = SMET
METEOPATH = ./input
STATION1 = STB
STATION2 = WFJ2
STATION3 = WFJ1
STATION4 = DAV1
[...]
[InputEditing]
STB::edit1 = EXCLUDE
STB::arg1::params = ILWR PSUM
WFJ2::edit1 = KEEP
WFJ2::arg1::params = PSUM ILWR RSWR
STB::edit2 = MERGE
STB::arg2::merge = WFJ2 WFJ1
STB::arg2::merge_strategy = FULL_MERGE
DAV1::edit1 = MERGE
DAV1::arg1::merge = WFJ2
DAV1::arg1::params = HS RSWR PSUM
Note
One limitation when handling "extra" parameters (ie parameters that are not in the default meteoparam) is that these extra parameters must be known from the beginning. So if station2 appears later in time with extra parameters, make sure that the buffer size is large enough to reach all the way to this new station (by setting General::BUFFER_SIZE at least to the number of days from the start of the first station to the start of the second station)

#include <DataEditingAlgorithms.h>

Public Member Functions

 EditingMerge (const std::string &i_stationID, const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
 
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...
 
std::set< std::string > requiredIDs () const
 Get the station IDs this editing block depends on for this station. More...
 
- Public Member Functions inherited from 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)
 
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
 

Additional Inherited Members

- Protected Member Functions inherited from mio::EditingBlock
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 inherited from mio::EditingBlock
static std::set< std::string > initStationSet (const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &keyword)
 
- Protected Attributes inherited from mio::EditingBlock
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

◆ EditingMerge()

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

Member Function Documentation

◆ editTimeSeries() [1/2]

void mio::EditingMerge::editTimeSeries ( STATIONS_SET vecStation)
virtual

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 from mio::EditingBlock.

◆ editTimeSeries() [2/2]

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

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 from mio::EditingBlock.

◆ requiredIDs()

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

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

Returns
a set of station IDs it depends on

Reimplemented from mio::EditingBlock.


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