WSL/SLF GitLab Repository

Commit b6d44aa1 authored by Thomas Egger's avatar Thomas Egger
Browse files

Added a possibility to push meteo data into the IOManager in case the user...

Added a possibility to push meteo data into the IOManager in case the user does not wish to read meteo data with MeteoIO but wishes to use other functionality provided by the IOManager (e.g. resampling, interpolation, filtering):

iomanager.push_meteo_data(IOManager::filtered, date_start, date_end, vec_meteo);
parent d67ddf6c
......@@ -52,6 +52,22 @@ double IOManager::getAvgSamplingRate()
}
}
void IOManager::push_meteo_data(const ProcessingLevel& level, const Date& date_start, const Date& date_end,
const std::vector< METEO_TIMESERIE >& vecMeteo)
{
//perform check on date_start and date_end
if (date_end < date_start)
throw InvalidArgumentException("date_start cannot be greater than date_end", AT);
if (level == IOManager::filtered){
fcache_start = date_start;
fcache_end = date_end;
filtered_cache = vecMeteo;
} else {
throw InvalidArgumentException("The processing level is invalid (should be raw OR filtered)", AT);
}
}
unsigned int IOManager::getStationData(const Date& date, STATION_TIMESERIE& vecStation)
{
vecStation.clear();
......@@ -107,8 +123,9 @@ void IOManager::fill_filtered_cache()
//ask the bufferediohandler for the whole buffer
const vector< METEO_TIMESERIE >& buffer = bufferedio.get_complete_buffer(fcache_start, fcache_end);
//cout << "Now filtering ..." << endl;
//cout << "Now filtering ... data for " << buffer.size() << " stations" << endl; clock_t cstart = std::clock();
meteoprocessor.process(buffer, filtered_cache);
//cout << "Filtering: " << ( std::clock() - cstart ) / (double)CLOCKS_PER_SEC << " seconds" << endl;
}
}
......
......@@ -97,6 +97,20 @@ class IOManager {
*/
unsigned int getMeteoData(const Date& i_date, METEO_TIMESERIE& vecMeteo);
/**
* @brief Push a vector of time series of MeteoData objects into the IOManager. This overwrites
* any internal buffers that are used and subsequent calls to getMeteoData or interpolate
* will be performed upon this data. This method is a way to bypass the internal reading
* of MeteoData from a certain source and is useful in case the user is only interested
* in data processing and interpolation performed by the IOManager object.
* @param level Level of processing that has already been performed on the data (raw XOR filtered)
* @param date_start Representing the beginning of the data
* @param date_end Representing the end of the data
* @param vecMeteo The actual data being pushed into the IOManager object
*/
void push_meteo_data(const ProcessingLevel& level, const Date& date_start, const Date& date_end,
const std::vector< METEO_TIMESERIE >& vecMeteo);
#ifdef _POPC_ //HACK popc
void interpolate(/*const*/ Date& date, /*const*/ DEMObject& dem, /*const*/ MeteoData::Parameters meteoparam,
Grid2DObject& result);
......@@ -152,7 +166,7 @@ class IOManager {
std::map<Date, METEO_TIMESERIE > resampled_cache; ///< stores already resampled data points
std::vector< METEO_TIMESERIE > filtered_cache; ///< stores already filtered data intervals
Date fcache_start, fcache_end;
Date fcache_start, fcache_end; ///< store the beginning and the end date of the filtered_cache
unsigned int processing_level;
};
} //end namespace
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment