WSL/SLF GitLab Repository

Skip to content
Snippets Groups Projects
Commit 293eaa4e authored by Mathias Bavay's avatar Mathias Bavay
Browse files

An optimization from Yesterday was actually breaking the whole resampling......

An optimization from Yesterday was actually breaking the whole resampling... This has been fixed (thanks to Nander and David for finding this problem!)
parent 06171ad6
No related branches found
No related tags found
No related merge requests found
......@@ -403,7 +403,7 @@ void ResamplingAlgorithms::getNearestValidPts(const size_t& pos, const size_t& p
indexP2=IOUtils::npos;
const Date dateStart = resampling_date - window_size;
if(vecM[0].date<=dateStart) { //we try to find a valid point only if it's even worth it...
for (size_t ii=pos; (ii--) > 0; ) {
if (vecM[ii].date < dateStart) break;
if (vecM[ii](paramindex) != IOUtils::nodata){
......@@ -411,12 +411,10 @@ void ResamplingAlgorithms::getNearestValidPts(const size_t& pos, const size_t& p
break;
}
}
}
//make sure the search window remains window_size
const Date dateEnd = (indexP1 != IOUtils::npos)? vecM[indexP1].date+window_size : resampling_date+window_size;
if(vecM[vecM.size()].date>=dateEnd) { //we try to find a valid point only if it's even worth it...
for (size_t ii=pos; ii<vecM.size(); ii++) {
if (vecM[ii].date > dateEnd) break;
if (vecM[ii](paramindex) != IOUtils::nodata) {
......@@ -425,7 +423,6 @@ void ResamplingAlgorithms::getNearestValidPts(const size_t& pos, const size_t& p
}
}
}
}
/**
* @brief This function solves the equation y = ax + b for two given points and returns y for a given x
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment