WSL/SLF GitLab Repository

Commit be423136 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The (advanced) configuration of the BufferedIOHandler through io.ini (General...

The (advanced) configuration of the BufferedIOHandler through io.ini (General section) has been added. It currently introduces two keywords (BUFF_CHUNKS_SIZE and BUFF_CHUNKS) to drive how much data to read at once and how much data to buffer. Currently, their product is directly used in the read, thus not reading anything by chunks smaller than a full buffer.

Fixed some << outputs, two compilation warnings found on Hera as well as introduced.
parent d48199ed
......@@ -22,11 +22,11 @@ using namespace std;
namespace mio {
#ifdef _POPC_
BufferedIOHandler::BufferedIOHandler(IOHandler& _iohandler, const Config& _cfg)
: iohandler(_iohandler), cfg(_cfg), mapBufferedGrids()
BufferedIOHandler::BufferedIOHandler(IOHandler& in_iohandler, const Config& in_cfg)
: iohandler(in_iohandler), cfg(in_cfg), mapBufferedGrids()
#else
BufferedIOHandler::BufferedIOHandler(IOHandler& _iohandler, const Config& _cfg)
: IOInterface(NULL), iohandler(_iohandler), cfg(_cfg), mapBufferedGrids()
BufferedIOHandler::BufferedIOHandler(IOHandler& in_iohandler, const Config& in_cfg)
: IOInterface(NULL), iohandler(in_iohandler), cfg(in_cfg), mapBufferedGrids()
#endif
{
setDfltBufferProperties();
......@@ -41,70 +41,70 @@ BufferedIOHandler::~BufferedIOHandler() throw()
setDfltBufferProperties();
}
void BufferedIOHandler::read2DGrid(Grid2DObject& _grid2Dobj, const std::string& _filename)
void BufferedIOHandler::read2DGrid(Grid2DObject& in_grid2Dobj, const std::string& in_filename)
{
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find(_filename);
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find(in_filename);
if (it != mapBufferedGrids.end()) { //already in map
_grid2Dobj = (*it).second;
in_grid2Dobj = (*it).second;
return;
}
Grid2DObject tmpgrid2D;
iohandler.read2DGrid(tmpgrid2D, _filename);
mapBufferedGrids[_filename] = tmpgrid2D;
_grid2Dobj = tmpgrid2D;
iohandler.read2DGrid(tmpgrid2D, in_filename);
mapBufferedGrids[in_filename] = tmpgrid2D;
in_grid2Dobj = tmpgrid2D;
}
void BufferedIOHandler::readDEM(DEMObject& _grid2Dobj)
void BufferedIOHandler::readDEM(DEMObject& in_grid2Dobj)
{
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find("/:DEM");
if (it != mapBufferedGrids.end()) {
//already in map. If the update properties have changed,
//we copy the ones given in input and force the update of the object
const DEMObject::update_type in_ppt = (DEMObject::update_type)_grid2Dobj.getUpdatePpt();
_grid2Dobj = (*it).second;
const DEMObject::update_type buff_ppt = (DEMObject::update_type)_grid2Dobj.getUpdatePpt();
const DEMObject::update_type in_ppt = (DEMObject::update_type)in_grid2Dobj.getUpdatePpt();
in_grid2Dobj = (*it).second;
const DEMObject::update_type buff_ppt = (DEMObject::update_type)in_grid2Dobj.getUpdatePpt();
if(in_ppt!=buff_ppt) {
_grid2Dobj.setUpdatePpt(in_ppt);
_grid2Dobj.update();
in_grid2Dobj.setUpdatePpt(in_ppt);
in_grid2Dobj.update();
}
return;
}
DEMObject tmpgrid2D;
//copy the updating policy of the destination
tmpgrid2D.setUpdatePpt((DEMObject::update_type)_grid2Dobj.getUpdatePpt());
tmpgrid2D.setUpdatePpt((DEMObject::update_type)in_grid2Dobj.getUpdatePpt());
iohandler.readDEM(tmpgrid2D);
mapBufferedGrids["/:DEM"] = tmpgrid2D;
_grid2Dobj = tmpgrid2D;
in_grid2Dobj = tmpgrid2D;
}
void BufferedIOHandler::readLanduse(Grid2DObject& _grid2Dobj)
void BufferedIOHandler::readLanduse(Grid2DObject& in_grid2Dobj)
{
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find("/:LANDUSE");
if (it != mapBufferedGrids.end()) { //already in map
_grid2Dobj = (*it).second;
in_grid2Dobj = (*it).second;
return;
}
Grid2DObject tmpgrid2D;
iohandler.readLanduse(tmpgrid2D);
mapBufferedGrids["/:LANDUSE"] = tmpgrid2D;
_grid2Dobj = tmpgrid2D;
in_grid2Dobj = tmpgrid2D;
}
void BufferedIOHandler::readAssimilationData(const Date& _date, Grid2DObject& _grid2Dobj)
void BufferedIOHandler::readAssimilationData(const Date& in_date, Grid2DObject& in_grid2Dobj)
{
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find("/:ASSIMILATIONDATA" + _date.toString(Date::FULL));
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find("/:ASSIMILATIONDATA" + in_date.toString(Date::FULL));
if (it != mapBufferedGrids.end()) { //already in map
_grid2Dobj = (*it).second;
in_grid2Dobj = (*it).second;
return;
}
Grid2DObject tmpgrid2D;
iohandler.readAssimilationData(_date, tmpgrid2D);
mapBufferedGrids["/:ASSIMILATIONDATA" + _date.toString(Date::FULL)] = tmpgrid2D;
_grid2Dobj = tmpgrid2D;
iohandler.readAssimilationData(in_date, tmpgrid2D);
mapBufferedGrids["/:ASSIMILATIONDATA" + in_date.toString(Date::FULL)] = tmpgrid2D;
in_grid2Dobj = tmpgrid2D;
}
void BufferedIOHandler::readStationData(const Date& date, std::vector<StationData>& vecStation)
......@@ -114,10 +114,10 @@ void BufferedIOHandler::readStationData(const Date& date, std::vector<StationDat
#ifdef _POPC_
void BufferedIOHandler::writeMeteoData(std::vector< std::vector<MeteoData> >& vecMeteo,
const std::string& name)
const std::string& name)
#else
void BufferedIOHandler::writeMeteoData(const std::vector< std::vector<MeteoData> >& vecMeteo,
const std::string& name)
const std::string& name)
#endif
{
iohandler.writeMeteoData(vecMeteo, name);
......@@ -125,8 +125,14 @@ void BufferedIOHandler::writeMeteoData(const std::vector< std::vector<MeteoData>
void BufferedIOHandler::setDfltBufferProperties()
{
always_rebuffer = true;
default_chunk_size = Date(15.0); //15 days
always_rebuffer = false;
double chunk_size_days = 15.; //default chunk size value
chunks=1;
cfg.getValue("BUFF_CHUNK_SIZE", "General", chunk_size_days,Config::nothrow); //in days
cfg.getValue("BUFF_CHUNKS", "General", chunks,Config::nothrow);
chunk_size = Date(chunk_size_days);
}
void BufferedIOHandler::setBufferPolicy(const buffer_policy& policy)
......@@ -164,21 +170,20 @@ const std::vector<METEO_DATASET>& BufferedIOHandler::get_complete_buffer(Date& s
}
void BufferedIOHandler::readMeteoData(const Date& date_start, const Date& date_end,
std::vector< std::vector<MeteoData> >& vecMeteo,
const unsigned int& /*stationindex*/)
std::vector< std::vector<MeteoData> >& vecMeteo,
const unsigned int& /*stationindex*/)
{
vecMeteo.clear();
Date current_buffer_end(date_start + default_chunk_size);
vector< vector<MeteoData> > tmp_meteo_buffer;
Date current_buffer_end(date_start + chunk_size*chunks);
vector< vector<MeteoData> > tmp_meteo_buffer; //it must be here -> adresses copied in 2. are still valid
//Read MeteoData for requested interval in chunks, furthermore buffer it
//Try to buffer after the requested chunk for subsequent calls
//0. initialize if not already initialized
if (vec_buffer_meteo.size() == 0) //init
bufferAllData(date_start, current_buffer_end);
bufferData(date_start, current_buffer_end, vec_buffer_meteo);
unsigned int buffer_size = vec_buffer_meteo.size();
......@@ -191,15 +196,15 @@ void BufferedIOHandler::readMeteoData(const Date& date_start, const Date& date_e
//only append
} else {
//rebuffer for real
bufferAllData(date_start, current_buffer_end);
bufferData(date_start, current_buffer_end, vec_buffer_meteo);
buffer_size = vec_buffer_meteo.size();
}
while (date_end > current_buffer_end){
iohandler.readMeteoData(current_buffer_end, current_buffer_end+default_chunk_size, tmp_meteo_buffer);
bufferData(current_buffer_end, current_buffer_end+chunk_size*chunks, tmp_meteo_buffer);
if (tmp_meteo_buffer.size() != buffer_size)
throw IOException("God damn it!", AT);
throw IOException("God damn it!", AT); //HACK: wrong, this can legitimately happen (not enough data available to fully fill the buffer)
//Loop through stations and append data
for (unsigned int ii=0; ii<buffer_size; ii++){
......@@ -213,7 +218,7 @@ void BufferedIOHandler::readMeteoData(const Date& date_start, const Date& date_e
vec_buffer_meteo[ii].insert(vec_buffer_meteo[ii].end(), tmp_meteo_buffer[ii].begin(), tmp_meteo_buffer[ii].end());
}
current_buffer_end += default_chunk_size;
current_buffer_end += chunk_size*chunks;
buffer_end = current_buffer_end;
}
}
......@@ -240,21 +245,22 @@ void BufferedIOHandler::readMeteoData(const Date& date_start, const Date& date_e
}
}
void BufferedIOHandler::bufferAllData(const Date& date_start, const Date& date_end){
vec_buffer_meteo.clear();
iohandler.readMeteoData(date_start, date_end, vec_buffer_meteo);
void BufferedIOHandler::bufferData(const Date& date_start, const Date& date_end, std::vector< std::vector<MeteoData> >& vecvecMeteo){
//TODO: implement reading data by chunks. It has to be done the same way as rebuffering
vecvecMeteo.clear(); //the plugins do it internally anyway, but this is cheap and safe...
iohandler.readMeteoData(date_start, date_end, vecvecMeteo);
buffer_start = date_start;
buffer_end = date_end;
}
void BufferedIOHandler::readSpecialPoints(std::vector<Coords>& _cpa)
void BufferedIOHandler::readSpecialPoints(std::vector<Coords>& in_cpa)
{
iohandler.readSpecialPoints(_cpa);
iohandler.readSpecialPoints(in_cpa);
}
void BufferedIOHandler::write2DGrid(const Grid2DObject& _grid2Dobj, const std::string& _name)
void BufferedIOHandler::write2DGrid(const Grid2DObject& in_grid2Dobj, const std::string& in_name)
{
iohandler.write2DGrid(_grid2Dobj, _name);
iohandler.write2DGrid(in_grid2Dobj, in_name);
}
void BufferedIOHandler::clearBuffer(){
......@@ -264,10 +270,11 @@ void BufferedIOHandler::clearBuffer(){
std::ostream& operator<<(std::ostream& os, const BufferedIOHandler& data)
{
os << "<BufferedIOHandler>\n";
os << "Config cfg = " << hex << &data.cfg << "\n";
os << "IOHandler &iohandler = " << hex << &data.iohandler << "\n";
os << "Config& cfg = " << hex << &data.cfg << dec << "\n";
os << "IOHandler &iohandler = " << hex << &data.iohandler << dec << "\n";
os << "Rebuffer if not found: " << data.always_rebuffer << "\n";
os << "Buffering " << data.chunks << " chunk(s) of " <<data.chunk_size.getJulianDate() << " days\n";
os << "Current buffer content (" << data.vec_buffer_meteo.size() << " stations, "
<< data.mapBufferedGrids.size() << " grids):\n";
......
......@@ -38,6 +38,11 @@ namespace mio {
* and transparently buffering the data. It follows the interface defined by the IOInterface class with the addition of
* a few convenience methods.
*
* @section buffereiohandler_keywords Keywords
* This module uses the following keywords to customize the buffering:
* - BUFF_CHUNKS: how many chunks of data to buffer; [General] section (NOT YET USED)
* - BUFF_CHUNK_SIZE: size in days of a chunk of data to read at once; [General] section
*
* @author Thomas Egger
* @date 2009-07-25
*/
......@@ -63,7 +68,7 @@ class BufferedIOHandler : public IOInterface {
* BufferedIOHandler bio(*io1, cfg);
* @endcode
*/
BufferedIOHandler(IOHandler& _iohandler, const Config& _cfg);
BufferedIOHandler(IOHandler& in_iohandler, const Config& in_cfg);
#ifdef _POPC_
virtual ~BufferedIOHandler();
#else
......@@ -117,16 +122,6 @@ class BufferedIOHandler : public IOInterface {
*/
void setBufferPolicy(const buffer_policy& policy);
/**
* @brief Manually tune the buffer
* @param _bufferbefore start date of the buffer (in offset to initially requested date)
* @param _bufferafter end date of the buffer (in offset to initially requested date)
* @code
* setBufferDuration(Date(2.0), Date(20.0)); //to get 2 days before the requested date to 20 days after
* @endcode
*/
void setBufferDuration(const Date& _bufferbefore, const Date& _bufferafter);
double getAvgSamplingRate();
friend std::ostream& operator<<(std::ostream& os, const BufferedIOHandler& data);
......@@ -137,13 +132,15 @@ class BufferedIOHandler : public IOInterface {
const std::vector<METEO_DATASET>& get_complete_buffer(Date& start, Date& end);
void setDfltBufferProperties();
void bufferAllData(const Date& date_start, const Date& date_end);
void bufferData(const Date& date_start, const Date& date_end, std::vector< std::vector<MeteoData> >& vecvecMeteo);
IOHandler& iohandler;
Config cfg;
const Config& cfg;
bool always_rebuffer;
Date buffer_start, buffer_end, default_chunk_size;
Date buffer_start, buffer_end;
Date chunk_size; ///< How much data to read at once
unsigned int chunks; ///< How many chuncks to buffer
std::vector< std::vector<MeteoData> > vec_buffer_meteo;
std::map<std::string, Grid2DObject> mapBufferedGrids;
......
......@@ -206,7 +206,7 @@ std::string Config::extract_section(std::string& key)
key.erase(key.begin(), key.begin() + pos + 2); //delete section name
return sectionname;
}
return "GENERAL";
return defaultSection;
}
void Config::write(const std::string& filename)
......
......@@ -461,6 +461,18 @@ Date& Date::operator-=(const Date& indate) {
return *this;
}
Date& Date::operator*=(const double& value) {
gmt_julian *= value;
calculateValues(gmt_julian, gmt_year, gmt_month, gmt_day, gmt_hour, gmt_minute);
return *this;
}
Date& Date::operator/=(const double& value) {
gmt_julian /= value;
calculateValues(gmt_julian, gmt_year, gmt_month, gmt_day, gmt_hour, gmt_minute);
return *this;
}
bool Date::operator==(const Date& indate) const {
const double epsilon=1./(24.*3600.); //that is, 1 second in units of days
return( fabs(indate.gmt_julian - gmt_julian) < epsilon );
......@@ -510,6 +522,16 @@ const Date Date::operator-(const Date& indate) const {
return tmp;
}
const Date Date::operator*(const double& value) const {
Date tmp(gmt_julian * value);
return tmp;
}
const Date Date::operator/(const double& value) const {
Date tmp(gmt_julian / value);
return tmp;
}
std::ostream& operator<<(std::ostream &os, const Date &date) {
os << "<date>\n";
os << date.toString(Date::ISO) << "\n";
......
......@@ -122,11 +122,6 @@ class Date {
friend std::ostream& operator<<(std::ostream& os, const Date& date);
//Operator Prototypes
///Can be used to add an interval to an existing Date object.
///Construct a Date object representing the interval e.g. Date(1.0) for 1 day and add that to another Date object.
Date& operator+=(const Date&);
///Can be used to subtract an interval from an existing Date object
Date& operator-=(const Date&);
bool operator==(const Date&) const;
bool operator!=(const Date&) const;
bool operator<(const Date&) const;
......@@ -134,8 +129,19 @@ class Date {
bool operator>(const Date&) const;
bool operator>=(const Date&) const;
///Intervals arithmetic
///Can be used to add an interval to an existing Date object.
///Construct a Date object representing the interval e.g. Date(1.0) for 1 day and add that to another Date object.
Date& operator+=(const Date&);
///Can be used to subtract an interval from an existing Date object
Date& operator-=(const Date&);
Date& operator*=(const double&);
Date& operator/=(const double&);
const Date operator+(const Date&) const;
const Date operator-(const Date&) const;
const Date operator*(const double&) const;
const Date operator/(const double&) const;
private:
double localToGMT(const double& _julian)const;
......
......@@ -244,8 +244,8 @@ void IOHandler::readMeteoData(const Date& date, METEO_DATASET& vecMeteo)
}
void IOHandler::readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector<METEO_DATASET>& vecMeteo,
const unsigned& stationindex)
std::vector<METEO_DATASET>& vecMeteo,
const unsigned& stationindex)
{
IOInterface *plugin = getPlugin("METEO", "Input");
plugin->readMeteoData(dateStart, dateEnd, vecMeteo, stationindex);
......@@ -295,7 +295,7 @@ std::string IOHandler::toString() const
{
std::stringstream os;
os << "<IOHandler>\n";
os << "Config cfg = " << hex << &cfg << "\n";
os << "Config cfg = " << hex << &cfg << dec << "\n";
os << "<mapPlugins>\n";
os << setw(10) << "Keyword" << " = " << IOPlugin::header << "\n";
......
......@@ -272,12 +272,13 @@ void IOManager::write2DGrid(const Grid2DObject& grid2D, const std::string& name)
std::ostream& operator<<(std::ostream& os, const IOManager& io)
{
os << "<IOManager>\n";
os << "Config cfg = " << hex << &io.cfg << "\n";
os << "Config& cfg = " << hex << &io.cfg << dec << "\n";
os << io.rawio;
os << io.bufferedio;
os << io.meteoprocessor;
os << "Processing level = " << io.processing_level << "\n";
//display meteocache
unsigned int count=0;
unsigned int min_stations=std::numeric_limits<unsigned int>::max();
unsigned int max_stations=-std::numeric_limits<unsigned int>::max();
......@@ -290,26 +291,40 @@ std::ostream& operator<<(std::ostream& os, const IOManager& io)
}
if(count==0) {
os << "Meteo cache is empty\n";
os << "Meteocache is empty\n";
}
if(count==1) {
os << "Meteo cache contains 1 element at " << io.meteo_cache.begin()->first.toString(Date::ISO);
os << " for ";
os << "Meteocache content (";
if(max_stations==min_stations)
os << min_stations << " station(s)\n";
os << min_stations;
else
os << "between " << min_stations << " and " << max_stations << " stations\n";
os << min_stations << " to " << max_stations;
os << " station(s))\n";
os << io.meteo_cache.begin()->first.toString(Date::ISO) << " - 1 timestep\n";
}
if(count>1) {
const double avg_sampling = ( (io.meteo_cache.rbegin()->first.getJulianDate()) - (io.meteo_cache.begin()->first.getJulianDate()) ) / (double)(count-1);
os << "Meteo cache goes from " << io.meteo_cache.begin()->first.toString(Date::ISO);
os << " to " << io.meteo_cache.rbegin()->first.toString(Date::ISO);
os << " with " << count << " timesteps (" << setprecision(3) << fixed << avg_sampling*24.*3600. << " s sampling rate)";
os << " for ";
os << "Meteocache content (";
if(max_stations==min_stations)
os << min_stations << " station(s)\n";
os << min_stations;
else
os << "between " << min_stations << " and " << max_stations << " stations\n";
os << min_stations << " to " << max_stations;
os << " station(s))\n";
os << io.meteo_cache.begin()->first.toString(Date::ISO);
os << " - " << io.meteo_cache.rbegin()->first.toString(Date::ISO);
os << " - " << count << " timesteps (" << setprecision(3) << fixed << avg_sampling*24.*3600. << " s sampling rate)";
}
//display filtered_cache
os << "Filteredcache content (" << io.filtered_cache.size() << " stations)\n";
for(unsigned int ii=0; ii<io.filtered_cache.size(); ii++) {
if (io.filtered_cache[ii].size() > 0){
os << std::setw(10) << io.filtered_cache[ii][0].meta.stationID << " = "
<< io.filtered_cache[ii][0].date.toString(Date::ISO) << " - "
<< io.filtered_cache[ii][io.filtered_cache[ii].size()-1].date.toString(Date::ISO) << ", "
<< io.filtered_cache[ii].size() << " timesteps" << endl;
}
}
os << "</IOManager>\n";
......
......@@ -128,7 +128,7 @@ class IOManager {
bool read_filtered_cache(const Date& start_date, const Date& end_date,
std::vector<METEO_DATASET>& vec_meteo);
Config cfg;
const Config& cfg;
IOHandler rawio;
BufferedIOHandler bufferedio;
MeteoProcessor meteoprocessor;
......
......@@ -149,7 +149,7 @@ string Meteo1DInterpolator::getInterpolationForParameter(const std::string& parn
std::ostream& operator<<(std::ostream& os, const Meteo1DInterpolator& Interpolator) {
os << "<Meteo1DInterpolator>\n";
os << "Config cfg = " << hex << &Interpolator.cfg << "\n";
os << "Config& cfg = " << hex << &Interpolator.cfg << dec <<"\n";
for (unsigned int jj=0; jj<Interpolator.tasklist.size(); jj++){
os << setw(10) << MeteoData::getParameterName(jj) << "::" << Interpolator.tasklist[jj] << "\t";
for (unsigned int ii=0; ii<Interpolator.taskargs[jj].size(); ii++){
......
......@@ -73,7 +73,7 @@ class Meteo1DInterpolator {
private:
std::string getInterpolationForParameter(const std::string& parname, std::vector<std::string>& vecArguments);
Config cfg;
const Config& cfg;
double window_size; ///< In seconds
std::vector<std::string> tasklist;
std::vector< std::vector< std::string > > taskargs;
......
......@@ -202,14 +202,8 @@ void Meteo2DInterpolator::checkMinMax(const double& minval, const double& maxval
std::ostream& operator<<(std::ostream &os, const Meteo2DInterpolator &mi) {
os << "<Meteo2DInterpolator>\n";
os << "Config *cfg = " << hex << &mi.cfg << "\n";
os << "IOManager *iomanager = " << hex << &mi.iomanager << "\n";
//os << "DemObject *dem= " << hex << &mi.dem << "\n";
//const unsigned int nb_stations = mi.vecMeteo.size();
//os << "Current vecMeteo content : " << nb_stations << " stations";
//if(nb_stations>0) os << " at " << mi.vecMeteo[0].date.toString(Date::ISO);
//os << " \n";
os << "Config& cfg = " << hex << &mi.cfg << dec << "\n";
os << "IOManager& iomanager = " << hex << &mi.iomanager << dec << "\n";
os << "User list of algorithms:\n";
std::map<std::string, std::vector<std::string> >::const_iterator iter = mi.mapAlgorithms.begin();
......
......@@ -156,8 +156,6 @@ class Meteo2DInterpolator {
const Config& cfg; ///< Reference to Config object, initialized during construction
IOManager& iomanager; ///< Reference to IOManager object, used for callbacks, initialized during construction
//const DEMObject& dem; ///< Reference to DEMObject object, initialized during construction
//const std::vector<MeteoData>& vecMeteo; ///< Reference to a vec of MeteoData, initialized during construction
std::map< std::string, std::vector<std::string> > mapAlgorithms; //per parameter interpolation algorithms
......
......@@ -16,6 +16,7 @@
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#include <meteoio/meteofilters/FilterMeanAvg.h>
#include <cmath>
using namespace std;
......@@ -113,7 +114,7 @@ void FilterMeanAvg::parse_args(std::vector<std::string> vec_args)
throw InvalidArgumentException("Invalid window size configuration for filter " + getName(), AT);
}
min_data_points = filter_args[0];
min_data_points = (unsigned int)floor(filter_args[0]);
min_time_span = Date(filter_args[1] / 86400.0);
}
......
......@@ -16,6 +16,7 @@
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#include <meteoio/meteofilters/FilterMedianAvg.h>
#include <cmath>
using namespace std;
......@@ -116,7 +117,7 @@ void FilterMedianAvg::parse_args(std::vector<std::string> vec_args)
throw InvalidArgumentException("Invalid window size configuration for filter " + getName(), AT);
}
min_data_points = filter_args[0];
min_data_points = (unsigned int)floor(filter_args[0]);
min_time_span = Date(filter_args[1] / 86400.0);
}
......
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