OGS
|
A container for sensor data at an observation site. The class stores a number of time series and has been created for use in Station-objects.
Definition at line 62 of file SensorData.h.
#include <SensorData.h>
Public Member Functions | |
SensorData (const std::string &file_name) | |
SensorData (std::vector< std::size_t > time_steps) | |
~SensorData () | |
void | addTimeSeries (const std::string &data_name, std::vector< float > *data, const std::string &data_unit_string="") |
void | addTimeSeries (SensorDataType data_name, std::vector< float > *data, const std::string &data_unit_string="") |
const std::vector< float > * | getTimeSeries (SensorDataType time_series_name) const |
Returns the time series with the given name. | |
const std::vector< SensorDataType > & | getTimeSeriesNames () const |
Returns all time series names contained in this container. | |
const std::vector< std::size_t > & | getTimeSteps () const |
Returns the time step vector (if it exists) | |
std::size_t | getStartTime () const |
Returns the first time step. | |
std::size_t | getEndTime () const |
Returns the last time step. | |
std::size_t | getStepSize () const |
void | setTimeUnit (TimeStepType t) |
Allows to set a unit for the time steps. | |
TimeStepType | getTimeUnit () const |
Returns the unit the time steps. | |
Static Public Member Functions | |
static std::string | convertSensorDataType2String (SensorDataType t) |
Converts Sensor Data Types to Strings. | |
static SensorDataType | convertString2SensorDataType (const std::string &s) |
Converts Strings to Sensor Data Types. | |
Private Member Functions | |
int | readDataFromFile (const std::string &file_name) |
Reads a CSV-file with time series data and fills the container. | |
Private Attributes | |
std::size_t | _start |
std::size_t | _end |
std::size_t | _step_size |
TimeStepType | _time_unit |
std::vector< std::string > | _data_unit_string |
std::vector< std::size_t > | _time_steps |
std::vector< SensorDataType > | _vec_names |
std::vector< std::vector< float > * > | _data_vecs |
|
explicit |
Constructor using file name (automatically reads the file and fills all data structures)
Definition at line 25 of file SensorData.cpp.
References readDataFromFile().
|
explicit |
Constructor using a time step vector valid for all time series that will be added later
Definition at line 31 of file SensorData.cpp.
References ERR().
SensorData::~SensorData | ( | ) |
Definition at line 45 of file SensorData.cpp.
References _data_vecs.
void SensorData::addTimeSeries | ( | const std::string & | data_name, |
std::vector< float > * | data, | ||
const std::string & | data_unit_string = "" ) |
Adds a time series that needs to conform to the time step vector specified in the constructor. Optionally a unit for the time series can be given. The name is converted to SensorDataType enum.
Definition at line 53 of file SensorData.cpp.
References addTimeSeries(), and convertString2SensorDataType().
Referenced by addTimeSeries().
void SensorData::addTimeSeries | ( | SensorDataType | data_name, |
std::vector< float > * | data, | ||
const std::string & | data_unit_string = "" ) |
Adds a time series that needs to conform to the time step vector specified in the constructor. Optionally a unit for the time series can be given.
Definition at line 62 of file SensorData.cpp.
References _data_unit_string, _data_vecs, _end, _start, _step_size, _time_steps, _vec_names, and WARN().
|
static |
Converts Sensor Data Types to Strings.
Definition at line 172 of file SensorData.cpp.
References EVAPORATION, PRECIPITATION, and TEMPERATURE.
Referenced by getTimeSeries(), and DiagramList::readList().
|
static |
Converts Strings to Sensor Data Types.
Definition at line 190 of file SensorData.cpp.
References EVAPORATION, OTHER, PRECIPITATION, and TEMPERATURE.
Referenced by addTimeSeries(), and readDataFromFile().
|
inline |
Returns the last time step.
Definition at line 104 of file SensorData.h.
References _end.
Referenced by DiagramPrefsDialog::DiagramPrefsDialog(), and DiagramList::readList().
|
inline |
Returns the first time step.
Definition at line 101 of file SensorData.h.
References _start.
Referenced by DiagramPrefsDialog::DiagramPrefsDialog(), and DiagramList::readList().
|
inline |
Returns the interval between time steps (Returns "0" if a vector is given!)
Definition at line 108 of file SensorData.h.
References _step_size.
Referenced by DiagramList::readList().
const std::vector< float > * SensorData::getTimeSeries | ( | SensorDataType | time_series_name | ) | const |
Returns the time series with the given name.
Definition at line 92 of file SensorData.cpp.
References _data_vecs, _vec_names, convertSensorDataType2String(), and ERR().
Referenced by DiagramList::readList().
|
inline |
Returns all time series names contained in this container.
Definition at line 92 of file SensorData.h.
References _vec_names.
Referenced by DiagramList::readList().
|
inline |
Returns the time step vector (if it exists)
Definition at line 98 of file SensorData.h.
References _time_steps.
Referenced by DiagramList::readList().
|
inline |
Returns the unit the time steps.
Definition at line 114 of file SensorData.h.
References _time_unit.
|
private |
Reads a CSV-file with time series data and fills the container.
Definition at line 107 of file SensorData.cpp.
References _data_unit_string, _data_vecs, _end, _start, _time_steps, _vec_names, convertString2SensorDataType(), INFO(), BaseLib::splitString(), and BaseLib::strDate2int().
Referenced by SensorData().
|
inline |
Allows to set a unit for the time steps.
Definition at line 111 of file SensorData.h.
References _time_unit.
|
private |
Definition at line 130 of file SensorData.h.
Referenced by addTimeSeries(), and readDataFromFile().
|
private |
Definition at line 133 of file SensorData.h.
Referenced by ~SensorData(), addTimeSeries(), getTimeSeries(), and readDataFromFile().
|
private |
Definition at line 127 of file SensorData.h.
Referenced by addTimeSeries(), getEndTime(), and readDataFromFile().
|
private |
Definition at line 126 of file SensorData.h.
Referenced by addTimeSeries(), getStartTime(), and readDataFromFile().
|
private |
Definition at line 128 of file SensorData.h.
Referenced by addTimeSeries(), and getStepSize().
|
private |
Definition at line 131 of file SensorData.h.
Referenced by addTimeSeries(), getTimeSteps(), and readDataFromFile().
|
private |
Definition at line 129 of file SensorData.h.
Referenced by getTimeUnit(), and setTimeUnit().
|
private |
Definition at line 132 of file SensorData.h.
Referenced by addTimeSeries(), getTimeSeries(), getTimeSeriesNames(), and readDataFromFile().