Commit 8179bb36 authored by remi cresson's avatar remi cresson
Browse files

ENH: rainfall data is optional

parent a59b1cd7
......@@ -190,14 +190,14 @@ private:
SetMinimumParameterIntValue("ndvi.reduce.cumul.day2", 1);
SetMaximumParameterIntValue("ndvi.reduce.cumul.day1", 31);
SetMaximumParameterIntValue("ndvi.reduce.cumul.day2", 31);
SetDefaultParameterInt("ndvi.reduce.cumul.day1", 1);
SetDefaultParameterInt("ndvi.reduce.cumul.day2", 31);
SetDefaultParameterInt ("ndvi.reduce.cumul.day1", 1);
SetDefaultParameterInt ("ndvi.reduce.cumul.day2", 31);
SetMinimumParameterIntValue("ndvi.reduce.cumul.month1", 1);
SetMinimumParameterIntValue("ndvi.reduce.cumul.month2", 1);
SetMaximumParameterIntValue("ndvi.reduce.cumul.month1", 12);
SetMaximumParameterIntValue("ndvi.reduce.cumul.month2", 12);
SetDefaultParameterInt("ndvi.reduce.cumul.month1", 7); // July
SetDefaultParameterInt("ndvi.reduce.cumul.month2", 10); // October
SetDefaultParameterInt ("ndvi.reduce.cumul.month1", 7); // July
SetDefaultParameterInt ("ndvi.reduce.cumul.month2", 10); // October
AddChoice("ndvi.reduce.max","Maximum in the year");
AddChoice("ndvi.reduce.amplitude","Amplitude in the year");
......@@ -225,33 +225,38 @@ private:
SetMinimumParameterIntValue("rain.reduce.cumul.day2", 1);
SetMaximumParameterIntValue("rain.reduce.cumul.day1", 31);
SetMaximumParameterIntValue("rain.reduce.cumul.day2", 31);
SetDefaultParameterInt("rain.reduce.cumul.day1", 1);
SetDefaultParameterInt("rain.reduce.cumul.day2", 31);
SetDefaultParameterInt ("rain.reduce.cumul.day1", 1);
SetDefaultParameterInt ("rain.reduce.cumul.day2", 31);
MandatoryOff ("rain.reduce.cumul.day1");
MandatoryOff ("rain.reduce.cumul.day2");
SetMinimumParameterIntValue("rain.reduce.cumul.month1", 1);
SetMinimumParameterIntValue("rain.reduce.cumul.month2", 1);
SetMaximumParameterIntValue("rain.reduce.cumul.month1", 12);
SetMaximumParameterIntValue("rain.reduce.cumul.month2", 12);
SetDefaultParameterInt("rain.reduce.cumul.month1", 6); // June
SetDefaultParameterInt("rain.reduce.cumul.month2", 10); // October
SetDefaultParameterInt ("rain.reduce.cumul.month1", 6); // June
SetDefaultParameterInt ("rain.reduce.cumul.month2", 10); // October
MandatoryOff ("rain.reduce.cumul.month1");
MandatoryOff ("rain.reduce.cumul.month2");
// Output residues
AddParameter(ParameterType_OutputImage, "residues", "Output image for NDVI residues");
SetDefaultOutputPixelType("residues", ImagePixelType_float);
MandatoryOff("residues");
MandatoryOff ("residues");
// Output residues trend
AddParameter(ParameterType_OutputImage, "restrend", "Output image for NDVI residues trend");
SetDefaultOutputPixelType("restrend", ImagePixelType_float);
MandatoryOff("restrend");
MandatoryOff ("restrend");
// Output residues trend labels
AddParameter(ParameterType_OutputImage, "reslabel", "Output image for NDVI residues trend labels");
SetDefaultOutputPixelType("reslabel", ImagePixelType_uint8);
MandatoryOff("reslabel");
MandatoryOff ("reslabel");
// Output factors labels
AddParameter(ParameterType_OutputImage, "factorslabel", "Output image for factors labels");
SetDefaultOutputPixelType("factorslabel", ImagePixelType_uint8);
MandatoryOff ("factorslabel");
AddRAMParameter();
......@@ -503,11 +508,19 @@ private:
m_FactorsLabelFilter->SetInput3(m_CorrelationFilter->GetOutput());
// Write factors image
SetParameterOutputImage("factorslabel", m_FactorsLabelFilter->GetOutput());
if (HasValue("factorslabel"))
{
SetParameterOutputImage("factorslabel", m_FactorsLabelFilter->GetOutput());
}
}
else
{
if (HasValue("factorslabel") || HasValue("reslabel") || HasValue("restrend") || HasValue("residues"))
{
otbAppLogFATAL("Please set input rainfall data to process indices.")
}
otbAppLogINFO("Rainfall data not set. Skipping rainfall based indices.")
}
......
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