diff --git a/app/otbSARAddBandInterferogram.cxx b/app/otbSARAddBandInterferogram.cxx index 80ab246df38fabf1d1b8110445bc99498c35802a..6da0843fa9f274207f62d79bc9d297c6f9adbf9d 100644 --- a/app/otbSARAddBandInterferogram.cxx +++ b/app/otbSARAddBandInterferogram.cxx @@ -81,12 +81,10 @@ namespace otb //Parameter declarations AddParameter(ParameterType_InputImage, "ininterfamp", "Input Interferogram with correct amplitude"); SetParameterDescription("ininterfamp", "Input Interferogram with correct amplitude."); - MandatoryOff("ininterfamp"); AddParameter(ParameterType_InputImage, "incomplexamp", "Input Compensated complex image"); SetParameterDescription("incomplexamp", "Input Compensated complex image."); - MandatoryOff("incomplexamp"); - + AddParameter(ParameterType_InputImage, "ininterf", "Input Interferogram"); SetParameterDescription("ininterf", "Input Interferogram."); @@ -121,7 +119,23 @@ namespace otb void DoUpdateParameters() override { - // Nothing to do here : all parameters are independent + // Handle the dependency between incomplexamp and ininterfamp (two kinds of pipelines) + if (GetParameterByKey("incomplexamp")->HasValue()) + { + DisableParameter("ininterfamp"); + MandatoryOff("ininterfamp"); + + otbAppLogINFO(<<"Complex input"); + } + else + { + EnableParameter("ininterfamp"); + MandatoryOn("ininterfamp"); + + MandatoryOff("incomplexamp"); + + otbAppLogINFO(<<"Interferogram input"); + } } void DoExecute() override diff --git a/app/otbSARDEMGrid.cxx b/app/otbSARDEMGrid.cxx index dedc931d505b975f9334fd2edde657ced9c98238..964d87d16186b96fd536dd641ed95be0cfec8a7a 100644 --- a/app/otbSARDEMGrid.cxx +++ b/app/otbSARDEMGrid.cxx @@ -122,7 +122,24 @@ private: void DoUpdateParameters() override { -// Nothing to do here : all parameters are independent + // Handle the dependency between indemproj* and indem (two kinds of pipelines) + if (GetParameterByKey("indemprojmaster")->HasValue() && GetParameterByKey("indemprojslave")->HasValue()) + { + DisableParameter("indem"); + MandatoryOff("indem"); + + otbAppLogINFO(<<"DEM Projection already estimated"); + } + else + { + EnableParameter("indem"); + MandatoryOn("indem"); + + MandatoryOff("indemprojmaster"); + MandatoryOff("indemprojslave"); + + otbAppLogINFO(<<"DEM Projection must be estimated"); + } } void DoExecute() override diff --git a/app/otbSARDeramp.cxx b/app/otbSARDeramp.cxx index b3e897876528713155b844197c3a7be844b33e72..7539b7bdb624f84318dc4b8e895e276fbda6b744 100644 --- a/app/otbSARDeramp.cxx +++ b/app/otbSARDeramp.cxx @@ -69,14 +69,12 @@ namespace otb AddParameter(ParameterType_InputImage, "inslave", "Input SAR slave image (for interferometry processing"); SetParameterDescription("inslave", "Slave SAR Image to extract SAR geometry (interferometry)."); - MandatoryOff("inslave"); AddParameter(ParameterType_OutputImage, "out", "Output burst"); SetParameterDescription("out","Output burst (deramped or reramped)."); AddParameter(ParameterType_InputImage, "ingrid", "Input deformation grid"); SetParameterDescription("ingrid", "Input deformation grid."); - MandatoryOff("ingrid"); AddParameter(ParameterType_Int, "gridsteprange", "Grid Step for range dimension into SLC geometry"); SetParameterDescription("gridsteprange", "Grid Step for range dimension into SLC geometry."); @@ -103,7 +101,27 @@ namespace otb void DoUpdateParameters() override { - // Nothing to do here : all parameters are independent + // Handle inputs following the mode chose by the user : shift mode + if (IsParameterEnabled("shift")) + { + // If shift mode : grid and slave image mandatory + EnableParameter("ingrid"); + EnableParameter("inslave"); + + MandatoryOn("ingrid"); + MandatoryOn("inslave"); + } + else + { + // Classic deramp or reramp without deformation grid of slave metadata + DisableParameter("ingrid"); + DisableParameter("inslave"); + + MandatoryOff("ingrid"); + MandatoryOff("inslave"); + + } + } void DoExecute() override diff --git a/app/otbSARMultiLook.cxx b/app/otbSARMultiLook.cxx index bdd0a7840a72d89fe554375dd9c95819ae1ed3b9..5091995604269f756e8882969028ed25937839e8 100644 --- a/app/otbSARMultiLook.cxx +++ b/app/otbSARMultiLook.cxx @@ -73,11 +73,9 @@ private: //Parameter declarations AddParameter(ParameterType_InputImage, "incomplex", "Input Complex image"); SetParameterDescription("incomplex", "Complex Image to perform computation on."); - MandatoryOff("incomplex"); AddParameter(ParameterType_InputImage, "inreal", "Input image"); SetParameterDescription("inreal", "Image to perform computation on."); - MandatoryOff("inreal"); AddParameter(ParameterType_Int, "mlran", "Averaging on distance"); SetParameterDescription("mlran","Averaging on distance"); @@ -111,7 +109,23 @@ private: void DoUpdateParameters() override { - // Nothing to do here : all parameters are independent + // Handle the dependency between incomplex and inreal (two kinds of pipelines) + if (GetParameterByKey("incomplex")->HasValue()) + { + DisableParameter("inreal"); + MandatoryOff("inreal"); + + otbAppLogINFO(<<"Complex input"); + } + else + { + EnableParameter("inreal"); + MandatoryOn("inreal"); + + MandatoryOff("incomplex"); + + otbAppLogINFO(<<"Real input"); + } } void DoExecute() override diff --git a/app/otbSARPhaseFiltering.cxx b/app/otbSARPhaseFiltering.cxx index 0d72864a94b49f3980d72eca7fcab826d54ba13d..6068b674678fc7fd003a50f6d356e1df7a757373 100644 --- a/app/otbSARPhaseFiltering.cxx +++ b/app/otbSARPhaseFiltering.cxx @@ -88,11 +88,9 @@ namespace otb //Parameter declarations AddParameter(ParameterType_InputImage, "incomplex", "Input Compensated complex image"); SetParameterDescription("incomplex", "Input Compensated complex image."); - MandatoryOff("incomplex"); AddParameter(ParameterType_InputImage, "ininterf", "Input Interferogram"); SetParameterDescription("ininterf", "Input Interferogram."); - MandatoryOff("ininterf"); AddParameter(ParameterType_Int, "sizetiles", "Size Tiles for output cut"); SetParameterDescription("sizetiles", "Size Tiles for output cut."); @@ -140,7 +138,23 @@ namespace otb void DoUpdateParameters() override { - // Nothing to do here : all parameters are independent + // Handle the dependency between incomplex and ininterf (two kinds of pipelines) + if (GetParameterByKey("incomplex")->HasValue()) + { + DisableParameter("ininterf"); + MandatoryOff("ininterf"); + + otbAppLogINFO(<<"Complex input"); + } + else + { + EnableParameter("ininterf"); + MandatoryOn("ininterf"); + + MandatoryOff("incomplex"); + + otbAppLogINFO(<<"Interferogram input"); + } } void DoExecute() override diff --git a/doc_cookbook/rst_API_Python/utils.rst b/doc_cookbook/rst_API_Python/utils.rst index 68119cc162a66d0e6e0ead2475e9c8700bfe6125..5afc12b5b51a29fcb04a46f55fd5e908a034a107 100644 --- a/doc_cookbook/rst_API_Python/utils.rst +++ b/doc_cookbook/rst_API_Python/utils.rst @@ -28,6 +28,22 @@ utils.func\_utils module :undoc-members: :show-inheritance: +utils.generateConfigFile module +------------------------------- + +.. automodule:: utils.generateConfigFile + :members: + :undoc-members: + :show-inheritance: + +utils.getEOFFromESA module +-------------------------- + +.. automodule:: utils.getEOFFromESA + :members: + :undoc-members: + :show-inheritance: + Module contents --------------- diff --git a/python_src/utils/generateConfigFile.py b/python_src/utils/generateConfigFile.py index 064b0f0e401afaa91428a692a125672dae7215e3..5c8fef3aa5ac8fbbd21eccb9ff2929e5f645cdda 100644 --- a/python_src/utils/generateConfigFile.py +++ b/python_src/utils/generateConfigFile.py @@ -19,6 +19,9 @@ import func_utils # Util fct for autocompletion def complete(text, state): + """ + Function for autocompletion + """ return (glob.glob(text+'*')+[None])[state] # Print with colors @@ -33,6 +36,9 @@ def prBlack(skk): print("\033[98m {}\033[00m" .format(skk)) # Input with colors def genericInput(skk, color) : + """ + Override input function for colors and exceptions + """ try: return input(color .format(skk)) except KeyboardInterrupt : @@ -54,6 +60,11 @@ def inBlack(skk): return genericInput(skk, "\033[98m {}\033[00m") # Questions to user for SAR_MultiSlc* chains def askForMultiSlc(dataConfig) : + """ + Q&A for SAR_MultiSlc* chains + Modify the dataConfig following user's awnsers + """ + # Select sensor if SAR_MultiSlc sensor = "S1IW" if (response == "SAR_MultiSlc") : @@ -188,6 +199,11 @@ def askForMultiSlc(dataConfig) : # Questions to user for diapOTB* chains def askForDiapOTB(dataConfig) : + """ + Q&A for diapOTB* chains + Modify the dataConfig following user's awnsers + """ + # Select sensor if diapOTB sensor = "S1IW" if (response == "diapOTB") : diff --git a/python_src/utils/getEOFFromESA.py b/python_src/utils/getEOFFromESA.py index 4bd436e3cc8f489071e4749ebb143f4991e01595..f575d150deb48c6a71020391c718827542bbb431 100644 --- a/python_src/utils/getEOFFromESA.py +++ b/python_src/utils/getEOFFromESA.py @@ -1,6 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +""" + getEOFFromESA.py + ================ + + Python script to retrieve from ESA website, the EOF files + +""" + import re import os import time