WSL/SLF GitLab Repository

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

Code cleanup and the ability to set a date from system date.

parent 3c26ceac
......@@ -98,6 +98,14 @@ Date::Date(const int& _year, const int& _month, const int& _day, const int& _hou
}
// SETTERS
/**
* @brief Set internal gmt time from system time
*/
void Date::setFromSys() {
setDate( time(NULL) ); //Unix time_t setter
}
/**
* @brief Set timezone and Daylight Saving Time flag.
* @param _timezone timezone as an offset to GMT (in hours)
......
......@@ -90,6 +90,7 @@ class Date {
Date(const time_t&, const double& _timezone=undefined, const bool& _dst=false);
Date(const Date& _date_in);
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);
......
......@@ -21,6 +21,8 @@ using namespace std;
namespace mio {
const unsigned int MeteoProcessor::window_half_size = 40; //org: 4
MeteoProcessor::MeteoProcessor(const Config& cfg) : mf(cfg), mi1d(cfg) {}
void MeteoProcessor::processData(const Date& date, const std::vector<MeteoData>& vecM, MeteoData& md)
......@@ -35,7 +37,7 @@ void MeteoProcessor::processData(const Date& date, const std::vector<MeteoData>&
* Cut out a window of data, on which the filtering and the resampling will occur
*/
bool windowexists = false;
for (int ii=(int)currentpos-5; ii<=(int)currentpos+4; ii++){
for (int ii=(int)(currentpos-window_half_size-1); ii<=(int)(currentpos+window_half_size); ii++){
if ((ii>=0) && (ii<(int)vecM.size())){
if (!windowexists){
......
......@@ -52,6 +52,7 @@ class MeteoProcessor {
private:
MeteoFilter mf;
Meteo1DInterpolator mi1d;
static const unsigned int window_half_size; //number of elements in filtering window on the left and right
};
} //end namespace
......
......@@ -475,10 +475,9 @@ void ImisIO::readMeteoData(const Date& dateStart, const Date& dateEnd, std::vect
}
void ImisIO::assimilateAnetzData(const Date& dateStart, const AnetzData& ad,
const std::vector< std::vector<double> > vec_of_psums,
const std::vector< std::vector<double> > vec_of_psums,
const std::map<std::string, unsigned int>& mapAnetzNames, const unsigned int& stationindex,
std::vector< std::vector<MeteoData> >& vecMeteo)
{
//Do coefficient calculation (getHNW) for every single station and data point
vector<double> current_station_psum;
......@@ -643,7 +642,7 @@ void ImisIO::findAnetzStations(const unsigned int& indexStart, const unsigned in
*/
void ImisIO::readData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo,
const unsigned int& stationindex, const std::vector<StationData>& vecStationNames,
oracle::occi::Environment*& env, oracle::occi::Connection*& conn)
oracle::occi::Environment*& env, oracle::occi::Connection*& conn)
{
vecMeteo.at(stationindex).clear();
......
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