MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mio::MeteoData Class Reference

Detailed Description

A class to represent a singular measurement received from one station at a certain time (represented by the Date object)

Author
Thomas Egger
Date
2008-12-05

#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)
 

Member Enumeration Documentation

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

merging_strategies.png
Merging strategies for two stations with different sampling rates
Note
Keep in mind that if a station is moving (ie. if its location might change in time) merge strategies other than STRICT_MERGE will introduce potentially invalid metadata (since the new position can not be reconstructed).
Enumerator
STRICT_MERGE 

Station1 receives data from station2 only for common timestamps.

EXPAND_MERGE 

If station2 can provide some data before/after station1, this extra data is added to station1.

FULL_MERGE 

All timestamps from station2 are brought into station1 even if the timestamps don't match.

this enum provides indexed access to meteorological fields

Enumerator
firstparam 
P 

Air pressure.

TA 

Air temperature.

RH 

Relative humidity.

TSG 

Temperature of the ground surface.

TSS 

Temperature of the snow surface.

HS 

Height of snow.

VW 

Wind velocity.

DW 

Wind direction.

VW_MAX 

Maximum wind velocity.

RSWR 

Reflected short wave radiation.

ISWR 

Incoming short wave radiation.

ILWR 

Incoming long wave radiation (downwelling)

TAU_CLD 

Cloud transmissivity or ISWR/ISWR_clear_sky.

PSUM 

Water equivalent of precipitations, either solid or liquid.

PSUM_PH 

Precipitation phase: between 0 (fully solid) and 1(fully liquid)

lastparam 

Constructor & Destructor Documentation

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.

Parameters
in_dateA 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.

Parameters
date_inA Date object representing the time of the measurement
meta_inA StationData object containing the meta data

Member Function Documentation

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.

Parameters
i_paramnameA parameter name, e.g. "VSWR"
Returns
A size_t denoting the index of the the parameter added
MeteoData::Merge_Type mio::MeteoData::getMergeType ( std::string  merge_type)
static

Parse a string containing a merge type and return the proper enum member for it.

Parameters
[in]merge_type
Returns
Merge_Type
const std::string & mio::MeteoData::getNameForParameter ( const size_t &  parindex) const
size_t mio::MeteoData::getNrOfParameters ( ) const
inline
size_t mio::MeteoData::getParameterIndex ( const std::string &  parname) const
const std::string & mio::MeteoData::getParameterName ( const size_t &  parindex)
static
bool mio::MeteoData::isResampled ( ) const
inline
void mio::MeteoData::merge ( std::vector< MeteoData > &  vec1,
const std::vector< MeteoData > &  vec2,
const bool &  simple_merge = false 
)
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.

Note
two stations are considered to be identical if they fit within a 5m 3D box
the vectors are supposed to contain data at a given time stamp. If both vectors don't match a common time stamp, nothing is done
Parameters
vec1reference vector, highest priority
vec2extra vector to merge, lowest priority
simple_mergeif set to true, assume all stations are unique (ie. simply append vec2 to vec1)
void mio::MeteoData::merge ( std::vector< MeteoData > &  vec,
const MeteoData meteo2,
const bool &  simple_merge = false 
)
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.

Note
two stations are considered to be identical if they fit within a 5m 3D box
the datasets are supposed to contain data at a given time stamp. If vec1 and meteo2 don't match a common time stamp, nothing is done
Parameters
vecreference vector, highest priority
meteo2extra MeteoData object to merge, lowest priority
simple_mergeif set to true, assume all stations are unique (ie.simply append meteo2 to vec)
void mio::MeteoData::merge ( std::vector< MeteoData > &  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].

Note
two stations are considered to be identical if they fit within a 5m 3D box
the datasets are supposed to contain data at a given time stamp. If the stations don't match a common time stamp, nothing is done
Parameters
vecvector of stations
MeteoData mio::MeteoData::merge ( MeteoData  meteo1,
const MeteoData meteo2 
)
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.

Note
no check on the location is performed, ie. it can merge data from stations kilometers away...
Parameters
meteo1reference MeteoData, highest priority
meteo2extra MeteoData to merge, lowest priority
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.

Note
no check on the location is performed, ie. it can merge data from stations kilometers away...
Parameters
meteo2extra MeteoData to merge, lowest priority
void mio::MeteoData::mergeTimeSeries ( std::vector< MeteoData > &  vec1,
const std::vector< MeteoData > &  vec2,
const Merge_Type strategy = STRICT_MERGE 
)
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).

Note
Only timestamps common to both data sets will be merged!
Parameters
vec1reference vector, highest priority
[in]vec2extra vector to merge, lowest priority
[in]strategyhow should the merge be done? (default: STRICT_MERGE)
bool mio::MeteoData::operator!= ( const MeteoData in) const
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
bool mio::MeteoData::operator< ( const MeteoData in) const
inline

so vectors can be sorted by timestamps

bool mio::MeteoData::operator== ( const MeteoData in) const

Operator that tests for equality.

bool mio::MeteoData::operator> ( const MeteoData in) const
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.

Parameters
parnameA string parameter, representing a meteo parameter, e.g. "VSWR"
Returns
A boolean indicating whether the parameter is a part of the object
void mio::MeteoData::reset ( )

Resets all the meteo parameters to IOUtils::nodata NOTE: member vars date and resampled are not affected.

void mio::MeteoData::setDate ( const Date in_date)
inline

A setter function for the measurement date.

Parameters
in_dateA Date object representing the time of the measurement
void mio::MeteoData::setResampled ( const bool &  in_resampled)
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

Friends And Related Function Documentation

std::iostream& operator<< ( std::iostream &  os,
const MeteoData data 
)
friend
std::iostream& operator>> ( std::iostream &  is,
MeteoData data 
)
friend

Member Data Documentation

Date mio::MeteoData::date

Timestamp of the measurement.

StationData mio::MeteoData::meta

The meta data of the measurement.

const size_t mio::MeteoData::nrOfParameters = MeteoData::lastparam - MeteoData::firstparam + 1
static

holds the number of meteo parameters stored in MeteoData


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