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 | Merge_Type { STRICT_MERGE =0, EXPAND_MERGE =1, FULL_MERGE =2 } |
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 | 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 } |
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 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 | isResampled () const |
void | setResampled (const bool &in_resampled) |
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 |
void | merge (const MeteoData &meteo2) |
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... | |
const std::string | toString () const |
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... | |
Static Public Member Functions | |
static const std::string & | getParameterName (const size_t &parindex) |
static void | mergeTimeSeries (std::vector< MeteoData > &vec1, const std::vector< MeteoData > &vec2, const Merge_Type &strategy=STRICT_MERGE) |
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) |
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) |
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) |
Simple merge strategy within a vector of MeteoData. All stations that can be considerd as identical (see note) will be merged in case of fields set to nodata. The priority goes to the stations at the begining 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) |
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... | |
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::iostream & | operator<< (std::iostream &os, const MeteoData &data) |
std::iostream & | operator>> (std::iostream &is, MeteoData &data) |
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 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 |
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 |
|
inline |
|
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 |
vec2 | extra vector to merge, lowest priority |
simple_merge | if set to true, assume all stations are unique (ie. simply append vec2 to vec1) |
|
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 |
meteo2 | extra MeteoData object to merge, lowest priority |
simple_merge | if set to true, assume all stations are unique (ie.simply append meteo2 to vec) |
|
static |
Simple merge strategy within a vector of MeteoData. All stations that can be considerd as identical (see note) will be merged in case of fields set to nodata. The priority goes to the stations at the begining 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 |
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.
void mio::MeteoData::merge | ( | const MeteoData & | meteo2 | ) |
Simple merge strategy. If some fields of the current object are nodata, they will be filled by the matching field from the provided argument.
meteo2 | extra MeteoData to merge, lowest priority |
|
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) |
|
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 |
|
inline |
void mio::MeteoData::standardizeNodata | ( | const double & | plugin_nodata | ) |
Standardize nodata values The plugin-specific nodata values are replaced by MeteoIO's internal nodata value.
const std::string mio::MeteoData::toString | ( | ) | const |
|
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