Commit 9fa75ba3 authored by remi cresson's avatar remi cresson
Browse files

FIX: change the cumul functor routine (now exact)

parent bf599896
......@@ -127,6 +127,7 @@ class TSCumulatedRangeReduceFunctor : public TSReduceFunctorBase<TInputPixel,TOu
public:
typedef typename TSReduceFunctorBase<TInputPixel,TOutputPixel>::DatesType DatesType;
typedef typename TSReduceFunctorBase<TInputPixel,TOutputPixel>::DateType DateType;
typedef typename TInputPixel::ValueType PixelValueType;
TSCumulatedRangeReduceFunctor() {}
......@@ -145,24 +146,22 @@ inline TOutputPixel operator ()(const TInputPixel& input) const
{
TOutputPixel output;
output.SetSize(this->GetOutputSize());
output.Fill(this->GetInputNoDataValue());
DatesType dates = this->GetDates();
int firstYear = dates[0].year;
for (unsigned int i = 0; i < input.Size(); i++)
{
int index = dates[i].year - firstYear;
PixelValueType inValue = input[i];
// Range check
if (inValue != this->GetInputNoDataValue())
for (unsigned int k = 0 ; k < this->GetOutputSize() ; k++)
{
DateType startDate(firstYear + k, m_Month, m_Day);
output[k] = 0;
for (unsigned int i = 0 ; i < input.Size() ; i++)
{
if (dates[i].IsInRange(m_Month, m_Day, m_NbOfDays))
PixelValueType inValue = input[i];
if (inValue != this->GetInputNoDataValue() && dates[i].IsInRange(startDate, m_NbOfDays))
{
output[index] += inValue;
output[k] += inValue;
}
}
}
return output;
......
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