WSL/SLF GitLab Repository

Commit 904aeaa8 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The full support for timezones has been brought back. This fixes issue 71. The...

The full support for timezones has been brought back. This fixes issue 71. The SMET, SMET, IMIS, BORMA plugins have been validated. Geotop should be validtaed if an input data set is available. A new class will have to be implemented to represent time periods. This is currently only a typedef pointing to the Date class, but a specific class would be welcomed.

GSN has been fixed for some changes on the web service, but does not retrieve the correct timestamps (is this a GSN issue?). The GSN compilation has been improved: the warnings related to GSOAP have been removed. 

A new long wave radiaiton model using cloudiness as input has been added (Omstedt, 1990). 
parent c47b45de
......@@ -60,7 +60,7 @@ const double A3DIO::plugin_nodata = -9999.0; //plugin specific nodata value
const unsigned int A3DIO::buffer_reserve = 23*24*2; //kind of average size of a buffer for optimizing vectors
//Main constructor
A3DIO::A3DIO(const std::string& configfile) : IOInterface(NULL), cfg(configfile)
A3DIO::A3DIO(const std::string& configfile) : IOInterface(NULL), cfg(configfile) //HACK is this constructor still needed?
{
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
in_tz = out_tz = 0.;
......@@ -77,7 +77,7 @@ A3DIO::A3DIO(const A3DIO& aio) : IOInterface(NULL), cfg(aio.cfg)
cfg.getValue("TZ","Output",out_tz,Config::nothrow);
}
A3DIO::A3DIO(const Config& cfgreader) : IOInterface(NULL), cfg(cfgreader)
A3DIO::A3DIO(const Config& in_cfg) : IOInterface(NULL), cfg(in_cfg)
{
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
in_tz = out_tz = 0.;
......@@ -263,7 +263,6 @@ void A3DIO::read1DMeteo(const Date& dateStart, const Date& dateEnd, std::vector<
Date tmp_date;
MeteoData tmpdata;
tmpdata.date.setTimeZone(in_tz);
StationData sd;
bool eofreached = false;
......@@ -328,7 +327,6 @@ void A3DIO::read1DMeteo(const Date& dateStart, const Date& dateEnd, std::vector<
bool A3DIO::readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string filename)
{
Date tmp_date;
tmp_date.setTimeZone(in_tz);
int tmp_ymdh[4];
std::vector<std::string> tmpvec;
tmpvec.reserve(6);
......@@ -344,7 +342,7 @@ bool A3DIO::readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string
throw InvalidFormatException(filename + ": " + line, AT);
}
tmp_date.setDate(tmp_ymdh[0],tmp_ymdh[1],tmp_ymdh[2],tmp_ymdh[3], 0);
tmp_date.setDate(tmp_ymdh[0],tmp_ymdh[1],tmp_ymdh[2],tmp_ymdh[3], 0., in_tz);
//Read rest of line with values ta, iswr, vw, rh, ea, hnw
......@@ -565,7 +563,6 @@ void A3DIO::read2DMeteoData(const std::string& filename, const std::string& para
unsigned int columns;
std::vector<std::string> tmpvec, vec_names;
Date tmp_date;
tmp_date.setTimeZone(in_tz);
int tmp_ymdh[4];
fin.clear();
......@@ -605,7 +602,7 @@ void A3DIO::read2DMeteoData(const std::string& filename, const std::string& para
throw InvalidFormatException("[E] Check date columns in " + filename, AT);
}
}
tmp_date.setDate(tmp_ymdh[0],tmp_ymdh[1],tmp_ymdh[2],tmp_ymdh[3],0);
tmp_date.setDate(tmp_ymdh[0],tmp_ymdh[1],tmp_ymdh[2],tmp_ymdh[3],0., in_tz);
MeteoData& currentMeteoData = vecM[0][bufferindex]; //1D Element to synchronize date
if (tmp_date == currentMeteoData.date) {
......@@ -788,7 +785,8 @@ int A3DIO::create1DFile(const std::vector< std::vector<MeteoData> >& data)
file.flags ( std::ios::fixed );
for(unsigned int j=0; j<size; j++) {
int yyyy, mm, dd, hh;
data[ii][j].date.getDate(yyyy, mm, dd, hh); //HACK: use out_tz!!
Date tmp_date(data[ii][j].date.getJulianDate(true), out_tz);
tmp_date.getDate(yyyy, mm, dd, hh);
file.fill('0');
file << setw(4) << yyyy << " " << setw(2) << mm << " " << setw(2) << dd << " " << setw(2) << hh << " ";
file.fill(' ');
......@@ -881,13 +879,15 @@ int A3DIO::write2DmeteoFile(const std::vector< std::vector<MeteoData> >& data,
std::ofstream file;
int startyear, year, month, day, hour;
data[0][0].date.getDate(startyear, month, day, hour);
Date tmp_date(data[0][0].date.getJulianDate(true), out_tz);
tmp_date.getDate(startyear, month, day, hour);
open2DFile(data, fileprefix, label, startyear, file);
file.flags ( ios::fixed );
for(unsigned int ii=0; ii<nb_timesteps; ii++) {
data[0][ii].date.getDate(year, month, day, hour); //HACK: use out_tz!!
tmp_date.setDate(data[0][ii].date.getJulianDate(true), out_tz);
tmp_date.getDate(year, month, day, hour);
if(year!=startyear) {
//if the year has changed, we need to write to a new file
file.close();
......
......@@ -86,7 +86,7 @@ class A3DIO : public IOInterface {
void write2DMeteo(const std::vector< std::vector<MeteoData> >& data);
double in_tz, out_tz; //timezones
Config cfg;
Config cfg; //HACK: only keep a reference!
std::ifstream fin; //Input file streams
std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
};
......
......@@ -132,7 +132,7 @@ void BufferedIOHandler::setDfltBufferProperties()
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);
chunk_size = Duration(chunk_size_days, 0);
}
void BufferedIOHandler::setBufferPolicy(const buffer_policy& policy)
......@@ -204,7 +204,7 @@ void BufferedIOHandler::readMeteoData(const Date& date_start, const Date& date_e
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); //HACK: wrong, this can legitimately happen (not enough data available to fully fill the buffer)
throw IOException("The number of stations changed over time, this is not handled yet!", AT);
//Loop through stations and append data
for (unsigned int ii=0; ii<buffer_size; ii++){
......
......@@ -11,6 +11,7 @@ ENDIF(PROJ4)
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteolaws/CMakeLists.txt")
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteofilters/CMakeLists.txt")
# FilterAlgorithms.cc obsoleted
SET(meteoio_sources
IOManager.cc
Matrix.cc
......@@ -19,7 +20,6 @@ SET(meteoio_sources
ResamplingAlgorithms.cc
Meteo1DInterpolator.cc
InterpolationAlgorithms.cc
FilterAlgorithms.cc
A3DIO.cc
Date.cc
Timer.cc
......
......@@ -45,56 +45,56 @@ Date::Date() {
/**
* @brief Julian date constructor.
* @param julian_in julian date to set
* @param _timezone timezone as an offset to GMT (in hours, optional)
* @param _dst is it DST? (default: no)
* @param in_timezone timezone as an offset to GMT (in hours, optional)
* @param in_dst is it DST? (default: no)
*/
Date::Date(const double& julian_in, const double& _timezone, const bool& _dst) {
Date::Date(const double& julian_in, const double& in_timezone, const bool& in_dst) {
timezone = 0;
dst = false;
setDate(julian_in, _timezone, _dst);
setDate(julian_in, in_timezone, in_dst);
}
/**
* @brief Unix date constructor.
* @param _time unix time (ie: as number of seconds since Unix Epoch)
* @param _timezone timezone as an offset to GMT (in hours, optional)
* @param _dst is it DST? (default: no)
* @param in_time unix time (ie: as number of seconds since Unix Epoch)
* @param in_timezone timezone as an offset to GMT (in hours, optional)
* @param in_dst is it DST? (default: no)
*/
Date::Date(const time_t& _time, const double& _timezone, const bool& _dst) {
Date::Date(const time_t& in_time, const double& in_timezone, const bool& in_dst) {
timezone = 0;
dst = false;
setDate(_time, _timezone, _dst);
setDate(in_time, in_timezone, in_dst);
}
//HACK: is it needed? Why paroc_base instead of POPC??
/**
* @brief Copy constructor.
* @param _date_in Date object to copy
* @param in_date Date object to copy
*/
#ifdef _POPC_
Date::Date(const Date& _date_in) : paroc_base()
Date::Date(const Date& in_date) : paroc_base()
#else
Date::Date(const Date& _date_in)
Date::Date(const Date& in_date)
#endif
{
setDate(_date_in.getJulianDate(), _date_in.getTimeZone(), _date_in.getDST());
setDate(in_date.getJulianDate(), in_date.getTimeZone(), in_date.getDST());
}
/**
* @brief Date constructor by elements.
* All values are checked for plausibility.
* @param _year in 4 digits
* @param _month please keep in mind that first month of the year is 1 (ie: not 0!)
* @param _day please keep in mind that first day of the month is 1 (ie: not 0!)
* @param _hour
* @param _minute
* @param _timezone timezone as an offset to GMT (in hours, optional)
* @param _dst is it DST? (default: no)
* @param in_year in 4 digits
* @param in_month please keep in mind that first month of the year is 1 (ie: not 0!)
* @param in_day please keep in mind that first day of the month is 1 (ie: not 0!)
* @param in_hour
* @param in_minute
* @param in_timezone timezone as an offset to GMT (in hours, optional)
* @param in_dst is it DST? (default: no)
*/
Date::Date(const int& _year, const int& _month, const int& _day, const int& _hour, const int& _minute, const double& _timezone, const bool& _dst)
Date::Date(const int& in_year, const int& in_month, const int& in_day, const int& in_hour, const int& in_minute, const double& in_timezone, const bool& in_dst)
{
timezone = 0;
dst = false;
setDate(_year, _month, _day, _hour, _minute, _timezone, _dst);
setDate(in_year, in_month, in_day, in_hour, in_minute, in_timezone, in_dst);
}
// SETTERS
......@@ -103,22 +103,22 @@ Date::Date(const int& _year, const int& _month, const int& _day, const int& _hou
* @brief Set internal gmt time from system time
*/
void Date::setFromSys() {
setDate( time(NULL) ); //Unix time_t setter
setDate( time(NULL), timezone ); //Unix time_t setter
}
/**
* @brief Set timezone and Daylight Saving Time flag.
* @param _timezone timezone as an offset to GMT (in hours)
* @param _dst is it DST?
* @param in_timezone timezone as an offset to GMT (in hours)
* @param in_dst is it DST?
*/
void Date::setTimeZone(const double& _timezone, const bool& _dst) {
void Date::setTimeZone(const double& in_timezone, const bool& in_dst) {
//please keep in mind that timezone might be fractional (ie: 15 minutes, etc)
if(abs(_timezone) > 12) {
if(abs(in_timezone) > 12) {
throw InvalidArgumentException("[E] Time zone can NOT be greater than +/-12!!", AT);
}
timezone = _timezone;
dst = _dst;
timezone = in_timezone;
dst = in_dst;
}
/**
......@@ -162,12 +162,12 @@ void Date::setDate(const int& _year, const int& _month, const int& _day, const i
/**
* @brief Set date from a julian date (JD).
* @param julian_in julian date to set
* @param _timezone timezone as an offset to GMT (in hours, optional)
* @param _dst is it DST? (default: no)
* @param in_timezone timezone as an offset to GMT (in hours, optional)
* @param in_dst is it DST? (default: no)
*/
void Date::setDate(const double& julian_in, const double& _timezone, const bool& _dst) {
if(_timezone!=undefined) {
setTimeZone(_timezone, _dst);
void Date::setDate(const double& julian_in, const double& in_timezone, const bool& in_dst) {
if(in_timezone!=undefined) { //HACK: is it still needed?
setTimeZone(in_timezone, in_dst);
}
gmt_julian = localToGMT(julian_in);
calculateValues(gmt_julian, gmt_year, gmt_month, gmt_day, gmt_hour, gmt_minute);
......@@ -196,13 +196,13 @@ void Date::setModifiedJulianDate(const double& julian_in, const double& _timezon
/**
* @brief Set date from a Unix date.
* @param _time unix time (ie: as number of seconds since Unix Epoch)
* @param _timezone timezone as an offset to GMT (in hours, optional)
* @param _dst is it DST? (default: no)
* @param in_time unix time (ie: as number of seconds since Unix Epoch)
* @param in_timezone timezone as an offset to GMT (in hours, optional)
* @param in_dst is it DST? (default: no)
*/
void Date::setUnixDate(const time_t& _time, const double& _timezone, const bool& _dst) {
const double _julian = (double)(_time)/(24.*60.*60.) + Unix_offset;
setDate(_julian, _timezone, _dst);
void Date::setUnixDate(const time_t& in_time, const double& in_timezone, const bool& in_dst) {
const double in_julian = (double)(in_time)/(24.*60.*60.) + Unix_offset;
setDate(in_julian, in_timezone, in_dst);
}
/**
......@@ -290,7 +290,7 @@ double Date::getTruncatedJulianDate(const bool& gmt) const {
* @param gmt convert returned value to GMT? (default: false)
* @return Unix time in the current timezone / in GMT depending on the gmt parameter
*/
time_t Date::getUnixDate(const bool& gmt) const {
time_t Date::getUnixDate(const bool& gmt) const { //HACK: should Unix date always be GMT?
if (gmt_julian < Unix_offset)
throw IOException("Dates before 1970 cannot be displayed in Unix epoch time", AT);
......@@ -448,7 +448,7 @@ bool Date::isLeapYear() const {
*/
}
// OPERATORS
// OPERATORS //HACK this will have to handle Durations
Date& Date::operator+=(const Date& indate) {
gmt_julian += indate.gmt_julian;
calculateValues(gmt_julian, gmt_year, gmt_month, gmt_day, gmt_hour, gmt_minute);
......@@ -461,6 +461,18 @@ Date& Date::operator-=(const Date& indate) {
return *this;
}
Date& Date::operator+=(const double& indate) {
gmt_julian += indate;
calculateValues(gmt_julian, gmt_year, gmt_month, gmt_day, gmt_hour, gmt_minute);
return *this;
}
Date& Date::operator-=(const double& indate) {
gmt_julian -= indate;
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);
......@@ -513,22 +525,32 @@ bool Date::operator>=(const Date& indate) const {
}
const Date Date::operator+(const Date& indate) const {
Date tmp(gmt_julian + indate.gmt_julian);
Date tmp(gmt_julian + indate.gmt_julian, timezone);
return tmp;
}
const Date Date::operator-(const Date& indate) const {
Date tmp(gmt_julian - indate.gmt_julian);
Date tmp(gmt_julian - indate.gmt_julian, timezone);
return tmp;
}
const Date Date::operator+(const double& indate) const {
Date tmp(gmt_julian + indate, timezone);
return tmp;
}
const Date Date::operator-(const double& indate) const {
Date tmp(gmt_julian - indate, timezone);
return tmp;
}
const Date Date::operator*(const double& value) const {
Date tmp(gmt_julian * value);
Date tmp(gmt_julian * value, timezone);
return tmp;
}
const Date Date::operator/(const double& value) const {
Date tmp(gmt_julian / value);
Date tmp(gmt_julian / value, timezone);
return tmp;
}
......@@ -595,7 +617,8 @@ const string Date::toString(FORMATS type, const bool& gmt) const
<< setw(2) << setfill('0') << day_out << "T"
<< setw(2) << setfill('0') << hour_out << ":"
<< setw(2) << setfill('0') << minute_out << " ("
<< setprecision(10) << julian_out << ")" ;
<< setprecision(10) << julian_out << ") GMT"
<< setw(2) << setfill('0') << showpos << timezone << noshowpos;
} else if(type==DIN) {
tmpstr
<< setw(2) << setfill('0') << day_out << "."
......
......@@ -86,19 +86,19 @@ class Date {
static const float Excel_offset;
Date();
Date(const double& julian_in, const double& _timezone=undefined, const bool& _dst=false);
Date(const int& year, const int& month, const int& day, const int& hour, const int& minute, const double& _timezone=undefined, const bool& _dst=false);
Date(const time_t&, const double& _timezone=undefined, const bool& _dst=false);
Date(const Date& _date_in);
Date(const double& julian_in, const double& in_timezone, const bool& in_dst=false);
Date(const int& year, const int& month, const int& day, const int& hour, const int& minute, const double& in_timezone, const bool& in_dst=false);
Date(const time_t&, const double& in_timezone, const bool& in_dst=false);
Date(const Date& in_date);
void setFromSys();
void setTimeZone(const double& _timezone, const bool& _dst=false);
void setDate(const double& julian_in, const double& _timezone=undefined, const bool& _dst=false);
void setDate(const int& year, const int& month, const int& day, const int& hour, const int& minute, const double& _timezone=undefined, const bool& _dst=false);
void setDate(const time_t& _time, const double& _timezone=undefined, const bool& _dst=false);
void setModifiedJulianDate(const double& julian_in, const double& _timezone=undefined, const bool& _dst=false);
void setUnixDate(const time_t& _time, const double& _timezone=undefined, const bool& _dst=false);
void setExcelDate(const double excel_in, const double& _timezone=undefined, const bool& _dst=false);
void setTimeZone(const double& in_timezone, const bool& in_dst=false);
void setDate(const double& julian_in, const double& in_timezone, const bool& _dst=false);
void setDate(const int& year, const int& month, const int& day, const int& hour, const int& minute, const double& in_timezone, const bool& _dst=false);
void setDate(const time_t& in_time, const double& in_timezone, const bool& _dst=false);
void setModifiedJulianDate(const double& julian_in, const double& in_timezone, const bool& _dst=false);
void setUnixDate(const time_t& in_time, const double& in_timezone, const bool& _dst=false);
void setExcelDate(const double excel_in, const double& in_timezone, const bool& _dst=false);
double getTimeZone() const;
bool getDST() const;
......@@ -133,21 +133,24 @@ class Date {
///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&);
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;
const Date operator*(const double&) const;
const Date operator/(const double&) const;
private:
double localToGMT(const double& _julian)const;
double GMTToLocal(const double& _gmt_julian) const;
double calculateJulianDate(const int& _year, const int& _month, const int& _day, const int& _hour, const int& _minute) const;
void calculateValues(const double& julian, int& _year, int& _month, int& _day, int& _hour, int& _minute) const;
protected:
double localToGMT(const double& in_julian)const;
double GMTToLocal(const double& in_gmt_julian) const;
double calculateJulianDate(const int& in_year, const int& in_month, const int& in_day, const int& in_hour, const int& in_minute) const;
void calculateValues(const double& julian, int& out_year, int& out_month, int& out_day, int& out_hour, int& out_minute) const;
long getJulianDayNumber(const int&, const int&, const int&) const;
bool isLeapYear(const int&) const;
void plausibilityCheck(const int& in_year, const int& in_month, const int& in_day, const int& in_hour, const int& in_minute) const;
......@@ -158,6 +161,9 @@ class Date {
int gmt_year, gmt_month, gmt_day, gmt_hour, gmt_minute;
static const double undefined;
};
typedef Date Duration; //so that later, we can implement a true Interval/Duration class
} //end namespace
#endif
......@@ -25,7 +25,7 @@ IOManager::IOManager(const Config& i_cfg) : cfg(i_cfg), rawio(i_cfg), bufferedio
{
setProcessingLevel(IOManager::filtered | IOManager::resampled);
fcache_start = fcache_end = Date(0.0);
fcache_start = fcache_end = Date(0.0, 0.); //HACK this should not matter, since 0 is still way back before any real data...
meteoprocessor.getWindowSize(proc_properties);
}
......@@ -173,7 +173,7 @@ unsigned int IOManager::getMeteoData(const Date& i_date, std::vector<MeteoData>&
//1. Check whether user wants raw data or processed data
if (processing_level == IOManager::raw){
rawio.readMeteoData(i_date-Date(0.001), i_date+Date(0.001), vec_cache);
rawio.readMeteoData(i_date-Duration(0.001, 0.), i_date+Duration(0.001, 0.), vec_cache);
for (unsigned int ii=0; ii<vec_cache.size(); ii++){
unsigned int index = IOUtils::seek(i_date, vec_cache[ii], true);
if (index != IOUtils::npos)
......
......@@ -330,7 +330,7 @@ template<> bool IOUtils::convertString<bool>(bool& t, const std::string& str, st
return true;
}
template<> bool IOUtils::convertString<Date>(Date& t, const std::string& str, std::ios_base& (*f)(std::ios_base&))
bool IOUtils::convertString(Date& t, const std::string& str, const double& TZ, std::ios_base& (*f)(std::ios_base&))
{
std::string s = str;
trim(s); //delete trailing and leading whitespaces and tabs
......@@ -341,17 +341,17 @@ template<> bool IOUtils::convertString<Date>(Date& t, const std::string& str, st
//HACK: we read the seconds, but we ignore them...
if (sscanf(s.c_str(), "%u-%u-%u %u:%u:%u%31s", &year, &month, &day, &hour, &minute, &second, rest) >= 6) {
t.setDate(year, month, day, hour, minute);
t.setDate(year, month, day, hour, minute, TZ);
} else if (sscanf(s.c_str(), "%u-%u-%uT%u:%u:%u%31s", &year, &month, &day, &hour, &minute, &second, rest) >= 6) {
t.setDate(year, month, day, hour, minute);
t.setDate(year, month, day, hour, minute, TZ);
} else if (sscanf(s.c_str(), "%u-%u-%u %u:%u%31s", &year, &month, &day, &hour, &minute, rest) >= 5) {
t.setDate(year, month, day, hour, minute);
t.setDate(year, month, day, hour, minute, TZ);
} else if (sscanf(s.c_str(), "%u-%u-%uT%u:%u%31s", &year, &month, &day, &hour, &minute, rest) >= 5) {
t.setDate(year, month, day, hour, minute);
t.setDate(year, month, day, hour, minute, TZ);
} else if (sscanf(s.c_str(), "%u-%u-%u%31s", &year, &month, &day, rest) >= 3) {
t.setDate(year, month, day, 0, 0);
t.setDate(year, month, day, 0, 0, TZ);
} else if (sscanf(s.c_str(), "%u:%u%31s", &hour, &minute, rest) >= 2) {
t.setDate( ((double)hour)/24. + ((double)minute)/24./60. );
t.setDate( ((double)hour)/24. + ((double)minute)/24./60. , TZ);
} else {
//try to read purely numerical date, potentially surrounded by other chars
const unsigned int in_len = str.length();
......@@ -384,7 +384,7 @@ template<> bool IOUtils::convertString<Date>(Date& t, const std::string& str, st
}
}
t.setDate( year, month, day, hour, minute );
t.setDate( year, month, day, hour, minute, TZ );
}
std::string tmp(rest);
......@@ -449,6 +449,7 @@ unsigned int IOUtils::seek(const Date& soughtdate, const std::vector<MeteoData>&
}
//if we reach this point: the date is spanned by the buffer and there are at least two elements
//HACK: would it be better to create a timesries object and call vector's binary search on it?
if (exactmatch){
unsigned int first = 1, last = vecM.size()-1;
......
......@@ -188,9 +188,10 @@ namespace IOUtils {
// fully specialized template functions (implementation must not be in header)
template<> bool convertString<std::string>(std::string& t, const std::string& str, std::ios_base& (*f)(std::ios_base&));
template<> bool convertString<bool>(bool& t, const std::string& str, std::ios_base& (*f)(std::ios_base&));
template<> bool convertString<Date>(Date& t, const std::string& str, std::ios_base& (*f)(std::ios_base&));
template<> bool convertString<Coords>(Coords& t, const std::string& str, std::ios_base& (*f)(std::ios_base&));
bool convertString(Date& t, const std::string& str, const double& TZ, std::ios_base& (*f)(std::ios_base&) = std::dec);
/**
* @brief Returns, with the requested type, the value associated to a key (template function).
* @tparam T [in] The type wanted for the return value (template type parameter).
......
......@@ -63,8 +63,8 @@ void Meteo1DInterpolator::getWindowSize(ProcessingProperties& o_properties)
o_properties.points_before = 1;
o_properties.points_after = 1;
o_properties.time_before = Date(window_size/2.0);
o_properties.time_after = Date(window_size/2.0);
o_properties.time_before = Duration(window_size/2.0, 0.);
o_properties.time_after = Duration(window_size/2.0, 0.);
}
unsigned int Meteo1DInterpolator::resampleData(const Date& date, std::vector<MeteoData>& vecM)
......
......@@ -144,7 +144,7 @@ unsigned int MeteoData::getNrOfParameters() const
return nrOfAllParameters;
}
MeteoData::MeteoData() : date(0.0), resampled(false)
MeteoData::MeteoData() : date(0.0, 0.), resampled(false)
{
initParameterMap(); //must be first statement
initAllParameters();
......@@ -185,9 +185,9 @@ MeteoData& MeteoData::operator=(const MeteoData& rhs)
return *this;
}
void MeteoData::setDate(const Date& _date)
void MeteoData::setDate(const Date& in_date)
{
date = _date;
date = in_date;
}
void MeteoData::reset()
......@@ -220,9 +220,9 @@ bool MeteoData::isResampled() const
return resampled;
}
void MeteoData::setResampled(const bool& _resampled)
void MeteoData::setResampled(const bool& in_resampled)
{
resampled = _resampled;
resampled = in_resampled;
}
bool MeteoData::operator==(const MeteoData& in) const
......@@ -311,8 +311,8 @@ bool MeteoData::param_exists(const std::string& parname) const
std::ostream& operator<<(std::ostream& os, const MeteoData& data) {
os << "<meteo>\n";
os << data.date;
os << data.meta;
os << data.date.toString(Date::FULL) << "\n";
std::map<unsigned int, double*>::const_iterator it1;
for (it1=data.meteoparam.begin(); it1 != data.meteoparam.end(); it1++){
......
......@@ -82,7 +82,7 @@ class MeteoData {
* @brief A constructor that sets the measurment time
* @param _date A Date object representing the time of the measurement
*/
MeteoData(const Date& _date);
MeteoData(const Date& in_date);
/**
* @brief General setter function, requires one to eight arguments
......@@ -95,7 +95,7 @@ class MeteoData {
* @brief A setter function for the measurement date
* @param _date A Date object representing the time of the measurement
*/
void setDate(const Date& _date);
void setDate(const Date& in_date);
/**
* @brief Add another variable to the MeteoData object,
......@@ -169,7 +169,7 @@ class MeteoData {
bool resampled; ///<set this to true if MeteoData is result of resampling
};
typedef std::vector<MeteoData> METEO_DATASET;
typedef std::vector<MeteoData> METEO_DATASET; //HACK: replace by TIMESERIE
} //end namespace
......
......@@ -140,8 +140,8 @@ void ResamplingAlgorithms::NearestNeighbour(const unsigned int& pos, const unsig