WSL/SLF GitLab Repository

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

fixed a bug when computing the amplitude with the "daily_avg" resampling...

fixed a bug when computing the amplitude with the "daily_avg" resampling algorithm. Very minor improvement to the MeteoData::merge method.
parent 04762bce
......@@ -753,9 +753,9 @@ double DailyAverage::getValue(const std::vector<MeteoData>& vecM, const size_t&
throw InvalidArgumentException(ss.str(), AT);
}
} else if (min!=IOUtils::nodata && max==IOUtils::nodata) {
A = (avg - min) * 2.;
A = (avg - min);
} else if (min==IOUtils::nodata && max!=IOUtils::nodata) {
A =(max - avg) * 2.;
A =(max - avg);
} else
throw InvalidArgumentException("Providing both AVG, MIN and MAX for \'"+algo+"\' is not supported!", AT);
......
......@@ -262,7 +262,8 @@ class Daily_solar : public ResamplingAlgorithms {
* The paremeter to be interpolated is assumed to be a daily average and a sinusoidal variation of the
* amplitude given as argument will be generated (it is also possible to provide the "phase" or the
* fraction of the day when the minimum is reached). If data bearing the same name followed by "_MIN" or "_MAX"
* exist, there is no need to provide an amplitude as they will be used instead.
* exist, there is no need to provide an amplitude as they will be used instead (but if the amplitude is provided, it
* will be used as a fallback when no min or max is available).
*
* @code
* [Interpolations1D]
......
......@@ -383,8 +383,7 @@ void MeteoData::merge(std::vector<MeteoData>& vec)
for (size_t ii=0; ii<nElems; ii++) {
if (mergeIdx[ii]==IOUtils::npos) continue; //this element has already been merged, skip
for (size_t jj=1; jj<nElems; jj++) {
for (size_t jj=ii+1; jj<nElems; jj++) {
if (vec[ii].meta.position==vec[jj].meta.position) {
vec[ii].merge( vec[jj] );
mergeIdx[jj]=IOUtils::npos; //this element will be skipped in the next loops
......
Markdown is supported
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