MeteoIODoc 2.11.0
mio::MeteoBuffer Class Reference

Detailed Description

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.

Author
Mathias Bavay
Date
2014-12-01

#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 beginning 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...
 
Date getDataStart () const
 Returns the real beginning of the data contained in the buffer. This is the start date of the available data that is in the buffer (it can be much later than the requested start date). More...
 
Date getDataEnd () const
 Returns the real end of the data contained in the buffer. This is the end date of the available data that is in the buffer (it can be much earlier than the requested end date). More...
 
bool empty () const
 Check if the buffer is empty. More...
 
size_t size () const
 Returns the number of stations present in the buffer. 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)
 

Constructor & Destructor Documentation

◆ MeteoBuffer()

mio::MeteoBuffer::MeteoBuffer ( )
inline

Member Function Documentation

◆ clear()

void mio::MeteoBuffer::clear ( )

Clear the buffer; the data is deleted and the start and end dates reset to undef

◆ empty()

bool mio::MeteoBuffer::empty ( ) const

Check if the buffer is empty.

Returns
true if the buffer is empty

◆ get() [1/2]

bool mio::MeteoBuffer::get ( const Date date,
METEO_SET vecMeteo 
) const

Get buffer data for a specific date.

Parameters
dateA Date object representing the date/time for the sought MeteoData objects
vecMeteoA vector of MeteoData objects to be filled with data
Returns
true if the data was in the buffer

◆ get() [2/2]

bool mio::MeteoBuffer::get ( const Date date_start,
const Date date_end,
std::vector< METEO_SET > &  vecMeteo 
) const

Get buffer data between two dates.

Parameters
date_startA Date object representing the beginning of an interval (inclusive)
date_endA Date object representing the end of an interval (inclusive)
vecMeteoA vector of vector<MeteoData> objects to be filled with data
Returns
true if the data was in the buffer

◆ getAvgSamplingRate()

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.

Returns
average sampling rate in Hz, nodata if the buffer is empty

◆ getBuffer()

std::vector< METEO_SET > & mio::MeteoBuffer::getBuffer ( )

◆ getBufferEnd()

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.

Returns
end date of the buffer

◆ getBufferStart()

Date mio::MeteoBuffer::getBufferStart ( ) const

Returns the beginning 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.

Returns
start date of the buffer

◆ getDataEnd()

Date mio::MeteoBuffer::getDataEnd ( ) const

Returns the real end of the data contained in the buffer. This is the end date of the available data that is in the buffer (it can be much earlier than the requested end date).

Returns
end date of the data or Date::undefined if no data is available

◆ getDataStart()

Date mio::MeteoBuffer::getDataStart ( ) const

Returns the real beginning of the data contained in the buffer. This is the start date of the available data that is in the buffer (it can be much later than the requested start date).

Returns
start date of the data or Date::undefined if no data is available

◆ push() [1/2]

void mio::MeteoBuffer::push ( const Date date_start,
const Date date_end,
const std::vector< METEO_SET > &  vecMeteo 
)

Add data representing the available data between two dates.

Parameters
date_startA Date object representing the beginning of an interval (inclusive)
date_endA Date object representing the end of an interval (inclusive)
vecMeteoA vector of vector<MeteoData> objects providing the data

◆ push() [2/2]

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.

Parameters
date_startA Date object representing the beginning of an interval (inclusive)
date_endA Date object representing the end of an interval (inclusive)
vecMeteoA vector of MeteoData objects providing the data

◆ setBufferEnd()

void mio::MeteoBuffer::setBufferEnd ( const Date date)

◆ setBufferStart()

void mio::MeteoBuffer::setBufferStart ( const Date date)

◆ size()

size_t mio::MeteoBuffer::size ( ) const
inline

Returns the number of stations present in the buffer.

Returns
number of stations in buffer

◆ toString()

const std::string mio::MeteoBuffer::toString ( ) const

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