A class to buffer meteorological data. This class buffers MeteoData objects. It is currently NOT a proper ring buffer, this should come in a later implementation.
#include <Buffer.h>
Public Member Functions | |
MeteoBuffer () | |
bool | get (const Date &date, METEO_SET &vecMeteo) const |
Get buffer data for a specific date. More... | |
bool | get (const Date &date_start, const Date &date_end, std::vector< METEO_SET > &vecMeteo) const |
Get buffer data between two dates. More... | |
double | getAvgSamplingRate () const |
Returns the average sampling rate in the data. This computes the average sampling rate of the data that is contained in the buffer. This is a quick estimate, centered on how often a station measures "something" (ie, how many timestamps do we have for this station in the buffer). if the station measures TA at h+0 and h+30 and RH at h+15 and h+45, it would return 4 measurements per hour. If the station measures TA and RH at h+0 and h+30, it would return 2 measurements per hour. More... | |
Date | getBufferStart () const |
Returns the begining of the buffer. This is the start date of the request that was given to the IOHandler. If there was no data at this date, then the date of the first data would be greater. More... | |
Date | getBufferEnd () const |
Returns the end of the buffer. This is the end date of the request that was given to the IOHandler. If there was no data at this date, then the date of the last data would be less. More... | |
bool | empty () const |
Check if the buffer is empty. More... | |
void | clear () |
Clear the buffer; the data is deleted and the start and end dates reset to undef More... | |
void | push (const Date &date_start, const Date &date_end, const std::vector< METEO_SET > &vecMeteo) |
Add data representing the available data between two dates. More... | |
void | push (const Date &date_start, const Date &date_end, const std::vector< MeteoData > &vecMeteo) |
Add a data point for several stations. The data is considered valid within the provided two dates. More... | |
const std::string | toString () const |
std::vector< METEO_SET > & | getBuffer () |
void | setBufferStart (const Date &date) |
void | setBufferEnd (const Date &date) |
|
inline |
void mio::MeteoBuffer::clear | ( | ) |
Clear the buffer; the data is deleted and the start and end dates reset to undef
bool mio::MeteoBuffer::empty | ( | ) | const |
Check if the buffer is empty.
bool mio::MeteoBuffer::get | ( | const Date & | date_start, |
const Date & | date_end, | ||
std::vector< METEO_SET > & | vecMeteo | ||
) | const |
Get buffer data between two dates.
date_start | A Date object representing the beginning of an interval (inclusive) |
date_end | A Date object representing the end of an interval (inclusive) |
vecMeteo | A vector of vector<MeteoData> objects to be filled with data |
double mio::MeteoBuffer::getAvgSamplingRate | ( | ) | const |
Returns the average sampling rate in the data. This computes the average sampling rate of the data that is contained in the buffer. This is a quick estimate, centered on how often a station measures "something" (ie, how many timestamps do we have for this station in the buffer). if the station measures TA at h+0 and h+30 and RH at h+15 and h+45, it would return 4 measurements per hour. If the station measures TA and RH at h+0 and h+30, it would return 2 measurements per hour.
std::vector< METEO_SET > & mio::MeteoBuffer::getBuffer | ( | ) |
Date mio::MeteoBuffer::getBufferEnd | ( | ) | const |
Returns the end of the buffer. This is the end date of the request that was given to the IOHandler. If there was no data at this date, then the date of the last data would be less.
Date mio::MeteoBuffer::getBufferStart | ( | ) | const |
Returns the begining of the buffer. This is the start date of the request that was given to the IOHandler. If there was no data at this date, then the date of the first data would be greater.
void mio::MeteoBuffer::push | ( | const Date & | date_start, |
const Date & | date_end, | ||
const std::vector< MeteoData > & | vecMeteo | ||
) |
Add a data point for several stations. The data is considered valid within the provided two dates.
void mio::MeteoBuffer::setBufferEnd | ( | const Date & | date | ) |
void mio::MeteoBuffer::setBufferStart | ( | const Date & | date | ) |
const std::string mio::MeteoBuffer::toString | ( | ) | const |