A class to represent a singular measurement received from one station at a certain time (represented by the Date object)
#include <MeteoData.h>
Public Types | |
enum | FORMATS { DFLT , FULL , COMPACT } |
Keywords for selecting the toString formats. More... | |
enum | Merge_Type { STRICT_MERGE =0 , EXPAND_MERGE =1 , FULL_MERGE =2 , WINDOW_MERGE =3 } |
Available MeteoData merging strategies. When the two stations both have data at a given time step, only the parameters that are not present in station1 will be taken from station2 (ie. station1 has priority). More... | |
enum | Merge_Conflicts { CONFLICTS_PRIORITY_FIRST =0 , CONFLICTS_PRIORITY_LAST =1 , CONFLICTS_AVERAGE =2 } |
Available MeteoData conflict resolution strategies. When two stations are merged, there is a merge conflict when they have different values for the same parameter at the same timestamp (please note that if one of them has nodata, it is not a conflict: the valid value will be used to replace the nodata). How to handle conflicts is defined by the choice of conflicts resolution strategy. More... | |
enum | Parameters { firstparam =0 , P =firstparam , TA , RH , TSG , TSS , HS , VW , DW , VW_MAX , RSWR , ISWR , ILWR , TAU_CLD , PSUM , PSUM_PH , lastparam =PSUM_PH } |
this enum provides indexed access to meteorological fields More... | |
Public Member Functions | |
MeteoData (void) | |
The default constructor initializing every double attribute to nodata and the Date to julian==0.0. More... | |
MeteoData (const Date &in_date) | |
A constructor that sets the measurment time. More... | |
MeteoData (const StationData &meta_in) | |
A constructor that sets the meta data and keeps julian ==0.0. More... | |
MeteoData (const Date &date_in, const StationData &meta_in) | |
A constructor that sets the measurment time and meta data. More... | |
void | setDate (const Date &in_date) |
A setter function for the measurement date. More... | |
size_t | addParameter (const std::string &i_paramname) |
Add another variable to the MeteoData object, a double value will be added and the nrOfParameters increased. More... | |
bool | param_exists (const std::string &parname) const |
Check whether a certain parameter is a part of this MeteoData instance. More... | |
void | reset () |
Resets all the meteo parameters to IOUtils::nodata NOTE: member vars date and resampled are not affected. More... | |
bool | isNodata () const |
Are all the fields set to nodata? More... | |
bool | isResampled () const |
void | setResampled (const bool &in_resampled) |
bool | isFiltered (const size_t ¶m) const |
void | setFiltered (const size_t ¶m, const bool &in_filtered=true) |
bool | isGenerated (const size_t ¶m) const |
void | setGenerated (const size_t ¶m, const bool &in_generated=true) |
bool | isResampledParam (const size_t ¶m) const |
void | setResampledParam (const size_t ¶m, const bool &in_resampled=true) |
void | standardizeNodata (const double &plugin_nodata) |
Standardize nodata values The plugin-specific nodata values are replaced by MeteoIO's internal nodata value. More... | |
double & | operator() (const size_t &parindex) |
const double & | operator() (const size_t &parindex) const |
double & | operator() (const std::string &parname) |
const double & | operator() (const std::string &parname) const |
const std::string & | getNameForParameter (const size_t &parindex) const |
size_t | getParameterIndex (const std::string &parname) const |
size_t | getNrOfParameters () const |
bool | merge (const MeteoData &meteo2, const Merge_Conflicts &conflicts_strategy=CONFLICTS_PRIORITY_FIRST) |
Simple merge strategy. If some fields of the current object are nodata, they will be filled by the matching field from the provided argument. More... | |
bool | hasConflicts (const MeteoData &meteo2) const |
Check for data conflicts between two MeteoData objects Conflicts are defined as two identical data fields having different non-nodata values. The metadata are NOT checked for conflict. More... | |
const std::string | toString (const FORMATS format=DFLT) const |
Print the content of the current object. More... | |
bool | operator== (const MeteoData &) const |
Operator that tests for equality. More... | |
bool | operator!= (const MeteoData &in) const |
Operator that tests for inequality. More... | |
bool | operator< (const MeteoData &in) const |
so vectors can be sorted by timestamps More... | |
bool | operator> (const MeteoData &in) const |
so vectors can be sorted by timestamps More... | |
const std::string | getStationID () const |
Static Public Member Functions | |
static const std::string & | getParameterName (const size_t &parindex) |
static size_t | getStaticParameterIndex (const std::string &parname) |
static MeteoGrids::Parameters | findGridParam (const Parameters &mpar) |
static Parameters | findMeteoParam (const MeteoGrids::Parameters &gpar) |
static size_t | mergeTimeSeries (std::vector< MeteoData > &vec1, const std::vector< MeteoData > &vec2, const Merge_Type &strategy=STRICT_MERGE, const Merge_Conflicts &conflicts_strategy=CONFLICTS_PRIORITY_FIRST) |
Simple merge strategy for two vectors containing meteodata time series for two stations. If some fields of the MeteoData objects given in the first vector are nodata, they will be filled by the matching field from the MeteoData objects given in the second vector (if the same timestamp exist). More... | |
static void | merge (std::vector< MeteoData > &vec1, const std::vector< MeteoData > &vec2, const bool &simple_merge=false, const Merge_Conflicts &conflicts_strategy=CONFLICTS_PRIORITY_FIRST) |
Simple merge strategy for vectors containing meteodata for a given timestamp. If some fields of the MeteoData objects given in the first vector are nodata, they will be filled by the matching field from the MeteoData objects given in the second vector (if the same location exist). Stations only occuring in the second vector will be appended to the first vector. More... | |
static void | merge (std::vector< MeteoData > &vec, const MeteoData &meteo2, const bool &simple_merge=false, const Merge_Conflicts &conflicts_strategy=CONFLICTS_PRIORITY_FIRST) |
Simple merge strategy for vectors containing meteodata for a given timestamp. If some fields of the MeteoData objects given in the first vector are nodata, they will be filled by the matching field from the MeteoData object given in the second argument (if the same location exist). If meteo2 does not describe a station already in vec, it will simply be appended. More... | |
static void | merge (std::vector< MeteoData > &vec, const Merge_Conflicts &conflicts_strategy=CONFLICTS_PRIORITY_FIRST) |
Simple merge strategy within a vector of MeteoData. All stations that can be considerd as identical (see note) will be merged using the defined conflict resolution policy (see Merge_Conflicts). The priority goes to the stations at the beginning of the vector. For example, if vec[0] has TA but no HS and vec[3] has TA and HS, then vec[0] will keep its TA and get HS from vec[3]. If vec[2] is further away than 5m from vec[0], then it can not contribute to vec[0]. More... | |
static MeteoData | merge (MeteoData meteo1, const MeteoData &meteo2, const Merge_Conflicts &conflicts_strategy=CONFLICTS_PRIORITY_FIRST) |
Simple merge strategy. If some fields of the object given as first argument are nodata, they will be filled by the matching field from the provided argument. More... | |
static MeteoData::Merge_Type | getMergeType (std::string merge_type) |
Parse a string containing a merge type and return the proper enum member for it. More... | |
static MeteoData::Merge_Conflicts | getMergeConflicts (std::string merge_conflicts) |
Parse a string containing a merge conflcits type and return the proper enum member for it. More... | |
static std::set< std::string > | listAvailableParameters (const std::vector< MeteoData > &vecMeteo) |
List the parameters that have a least one valid value in a vector of MeteoData. More... | |
static void | unifyMeteoData (METEO_SET &vecMeteo) |
Ensure all elements in a METEO_SET have the same parameters. More... | |
Public Attributes | |
Date | date |
Timestamp of the measurement. More... | |
StationData | meta |
The meta data of the measurement. More... | |
Static Public Attributes | |
static const size_t | nrOfParameters = MeteoData::lastparam - MeteoData::firstparam + 1 |
holds the number of meteo parameters stored in MeteoData More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const MeteoData &data) |
std::istream & | operator>> (std::istream &is, MeteoData &data) |
Available MeteoData conflict resolution strategies. When two stations are merged, there is a merge conflict when they have different values for the same parameter at the same timestamp (please note that if one of them has nodata, it is not a conflict: the valid value will be used to replace the nodata). How to handle conflicts is defined by the choice of conflicts resolution strategy.
Available MeteoData merging strategies. When the two stations both have data at a given time step, only the parameters that are not present in station1 will be taken from station2 (ie. station1 has priority).
this enum provides indexed access to meteorological fields
mio::MeteoData::MeteoData | ( | void | ) |
The default constructor initializing every double attribute to nodata and the Date to julian==0.0.
mio::MeteoData::MeteoData | ( | const Date & | in_date | ) |
A constructor that sets the measurment time.
in_date | A Date object representing the time of the measurement |
mio::MeteoData::MeteoData | ( | const StationData & | meta_in | ) |
A constructor that sets the meta data and keeps julian ==0.0.
meta_in | A StationData object containing the meta data |
mio::MeteoData::MeteoData | ( | const Date & | date_in, |
const StationData & | meta_in | ||
) |
A constructor that sets the measurment time and meta data.
date_in | A Date object representing the time of the measurement |
meta_in | A StationData object containing the meta data |
size_t mio::MeteoData::addParameter | ( | const std::string & | i_paramname | ) |
Add another variable to the MeteoData object, a double value will be added and the nrOfParameters increased.
i_paramname | A parameter name, e.g. "VSWR" |
|
static |
|
static |
|
static |
Parse a string containing a merge conflcits type and return the proper enum member for it.
[in] | merge_conflicts |
|
static |
Parse a string containing a merge type and return the proper enum member for it.
[in] | merge_type |
const std::string & mio::MeteoData::getNameForParameter | ( | const size_t & | parindex | ) | const |
|
inline |
size_t mio::MeteoData::getParameterIndex | ( | const std::string & | parname | ) | const |
|
static |
|
static |
|
inline |
bool mio::MeteoData::hasConflicts | ( | const MeteoData & | meteo2 | ) | const |
Check for data conflicts between two MeteoData objects Conflicts are defined as two identical data fields having different non-nodata values. The metadata are NOT checked for conflict.
[in] | meteo2 | other MeteoData to compare to |
bool mio::MeteoData::isFiltered | ( | const size_t & | param | ) | const |
bool mio::MeteoData::isGenerated | ( | const size_t & | param | ) | const |
bool mio::MeteoData::isNodata | ( | ) | const |
Are all the fields set to nodata?
|
inline |
bool mio::MeteoData::isResampledParam | ( | const size_t & | param | ) | const |
|
static |
List the parameters that have a least one valid value in a vector of MeteoData.
[in] | vecMeteo | vector to read the data from |
bool mio::MeteoData::merge | ( | const MeteoData & | meteo2, |
const Merge_Conflicts & | conflicts_strategy = CONFLICTS_PRIORITY_FIRST |
||
) |
Simple merge strategy. If some fields of the current object are nodata, they will be filled by the matching field from the provided argument.
[in] | meteo2 | extra MeteoData to merge, lowest priority |
[in] | conflicts_strategy | In case of conflicts, define how to resolve them (see Merge_Conflicts), default: CONFLICTS_PRIORITY_FIRST |
|
static |
Simple merge strategy. If some fields of the object given as first argument are nodata, they will be filled by the matching field from the provided argument.
meteo1 | reference MeteoData, highest priority | |
[in] | meteo2 | extra MeteoData to merge, lowest priority |
[in] | conflicts_strategy | In case of conflicts, define how to resolve them (see Merge_Conflicts), default: CONFLICTS_PRIORITY_FIRST |
|
static |
Simple merge strategy within a vector of MeteoData. All stations that can be considerd as identical (see note) will be merged using the defined conflict resolution policy (see Merge_Conflicts). The priority goes to the stations at the beginning of the vector. For example, if vec[0] has TA but no HS and vec[3] has TA and HS, then vec[0] will keep its TA and get HS from vec[3]. If vec[2] is further away than 5m from vec[0], then it can not contribute to vec[0].
vec | vector of stations | |
[in] | conflicts_strategy | In case of conflicts, define how to resolve them (see Merge_Conflicts), default: CONFLICTS_PRIORITY_FIRST |
|
static |
Simple merge strategy for vectors containing meteodata for a given timestamp. If some fields of the MeteoData objects given in the first vector are nodata, they will be filled by the matching field from the MeteoData object given in the second argument (if the same location exist). If meteo2 does not describe a station already in vec, it will simply be appended.
vec | reference vector, highest priority | |
[in] | meteo2 | extra MeteoData object to merge, lowest priority |
[in] | simple_merge | if set to true, assume all stations are unique (ie.simply append meteo2 to vec), default: false |
[in] | conflicts_strategy | In case of conflicts, define how to resolve them (see Merge_Conflicts), default: CONFLICTS_PRIORITY_FIRST |
|
static |
Simple merge strategy for vectors containing meteodata for a given timestamp. If some fields of the MeteoData objects given in the first vector are nodata, they will be filled by the matching field from the MeteoData objects given in the second vector (if the same location exist). Stations only occuring in the second vector will be appended to the first vector.
vec1 | reference vector, highest priority | |
[in] | vec2 | extra vector to merge, lowest priority |
[in] | simple_merge | if set to true, assume all stations are unique (ie. simply append vec2 to vec1), default: false |
[in] | conflicts_strategy | In case of conflicts, define how to resolve them (see Merge_Conflicts), default: CONFLICTS_PRIORITY_FIRST |
|
static |
Simple merge strategy for two vectors containing meteodata time series for two stations. If some fields of the MeteoData objects given in the first vector are nodata, they will be filled by the matching field from the MeteoData objects given in the second vector (if the same timestamp exist).
vec1 | reference vector, highest priority | |
[in] | vec2 | extra vector to merge, lowest priority |
[in] | strategy | how should the merge be done? (default: STRICT_MERGE) |
[in] | conflicts_strategy | In case of conflicts, define how to resolve them (see Merge_Conflicts), default: CONFLICTS_PRIORITY_FIRST |
|
inline |
Operator that tests for inequality.
double & mio::MeteoData::operator() | ( | const size_t & | parindex | ) |
const double & mio::MeteoData::operator() | ( | const size_t & | parindex | ) | const |
double & mio::MeteoData::operator() | ( | const std::string & | parname | ) |
const double & mio::MeteoData::operator() | ( | const std::string & | parname | ) | const |
|
inline |
so vectors can be sorted by timestamps
bool mio::MeteoData::operator== | ( | const MeteoData & | in | ) | const |
Operator that tests for equality.
|
inline |
so vectors can be sorted by timestamps
bool mio::MeteoData::param_exists | ( | const std::string & | parname | ) | const |
Check whether a certain parameter is a part of this MeteoData instance.
parname | A string parameter, representing a meteo parameter, e.g. "VSWR" |
void mio::MeteoData::reset | ( | ) |
Resets all the meteo parameters to IOUtils::nodata NOTE: member vars date and resampled are not affected.
|
inline |
A setter function for the measurement date.
in_date | A Date object representing the time of the measurement |
void mio::MeteoData::setFiltered | ( | const size_t & | param, |
const bool & | in_filtered = true |
||
) |
void mio::MeteoData::setGenerated | ( | const size_t & | param, |
const bool & | in_generated = true |
||
) |
|
inline |
void mio::MeteoData::setResampledParam | ( | const size_t & | param, |
const bool & | in_resampled = true |
||
) |
void mio::MeteoData::standardizeNodata | ( | const double & | plugin_nodata | ) |
Standardize nodata values The plugin-specific nodata values are replaced by MeteoIO's internal nodata value.
Print the content of the current object.
[in] | format | select the preferred output format |
|
static |
Ensure all elements in a METEO_SET have the same parameters.
This should be called before writing out the METEO_SET with a plugin such as smet in order to guarantee that all parameters are always present.
vecMeteo | METEO_SET to process |
|
friend |
|
friend |
Date mio::MeteoData::date |
Timestamp of the measurement.
StationData mio::MeteoData::meta |
The meta data of the measurement.
|
static |
holds the number of meteo parameters stored in MeteoData