Problem when using FlhMci operator with preset parameter

Hi there

I am trying to apply the FlhMci (and others algo, e.g. C2R) with GPT.
It worked in the past, but not this time - neither under UNIX, nor windows.

Not sure why.

In the case of FlhMci, I tried by passing a parameter file (.xml) and then using the band math option from the command line.
I am pretty confident my xml file is well parameterized, but in all cases I have always the same error message:
"Error: Operator ‘FlhMci’: unknown parameter ‘preset’

… where preset is needed as you need define “MERIS_L1B_MCI” as per SNAP FLHMCI displayed parameters when done manually.
I need to process a whole time series so I do need the command line. I’ve done it many (many) times but I am running into this problem this time. Looking forward to you response.
Error message below:

INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Loading external tools…
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Scanning for external tools adapters: /apps/esa-snap/4.0/s2tbx
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Scanning for external tools adapters: /apps/esa-snap/4.0/s3tbx
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Scanning for external tools adapters: /apps/esa-snap/4.0/s1tbx
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Scanning for external tools adapters: /home/blo065/.snap/auxdata/tool-adapters
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Scanning for external tools adapters: /apps/esa-snap/4.0/rstb
java.lang.RuntimeException: Operator ‘FlhMci’: cannot convert XML parameters for reason: Unknown element ‘preset’
at org.esa.snap.core.gpf.main.CommandLineTool.convertParameterMap(CommandLineTool.java:383)
at org.esa.snap.core.gpf.main.CommandLineTool.runOperator(CommandLineTool.java:258)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:246)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:150)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:122)
at org.esa.snap.core.gpf.main.GPT.run(GPT.java:54)
at org.esa.snap.core.gpf.main.GPT.main(GPT.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.esa.snap.runtime.Launcher.lambda$run$14(Launcher.java:55)
at org.esa.snap.runtime.Engine.runClientCode(Engine.java:189)
at org.esa.snap.runtime.Launcher.run(Launcher.java:51)
at org.esa.snap.runtime.Launcher.main(Launcher.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:62)
at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:57)
Caused by: com.bc.ceres.binding.ConversionException: Unknown element ‘preset’
at com.bc.ceres.binding.dom.DefaultDomConverter.convertDomChildToPropertySet(DefaultDomConverter.java:175)
at com.bc.ceres.binding.dom.DefaultDomConverter.convertDomToPropertySet(DefaultDomConverter.java:165)
at com.bc.ceres.binding.dom.DefaultDomConverter.convertDomToValue(DefaultDomConverter.java:158)
at org.esa.snap.core.gpf.main.CommandLineTool.convertParameterMap(CommandLineTool.java:380)
… 20 more

Error: Operator ‘FlhMci’: cannot convert XML parameters for reason: Unknown element ‘preset’

And I tried also:

gpt FlhMci -PlowerBaselineBandName=radiance_10 -PupperBaselineBandName=radiance_8 -PsignalBandName=radiance_9 -PslopeBandName=MCI_slope -Ssource=“mysourcefile.N1” -t “myOutputfile.dim” -Ppreset=“MERIS_L1B_MCI”

and

gpt FlhMci -p “myxmlparamterfile.xml” -Ssource=“mysourcefile.N1” -t “myOutputfile.dim”

If you remove the quotes from “MERIS_L1B_MCI” it should work.
Maybe it is the same problem in the parameter file.

Dear Marco
Thank you very much for your prompt reply.
I did that, too (re: removing, or adding, quotes after -Ppreset= ).

It did drive me mad, but I finally worked it out (after many hours).

Remove the preset option altogether, it will not work if defined (I am pretty sure, though it does appear in the SNAP Display parameters window option).

Your command should be:
gpt FlhMci -p “MyXMLfilepath.xml” -Ssource=“mysourcefile” -t "myoutputfile.dim’

Your generic xml (for MCI) is posted in my next reply.

If not calling an xml file it should be:
gpt FlhMci -PlowerBaselineBandName=radiance_10 -PupperBaselineBandName=radiance_8 -PsignalBandName=radiance_9 -PslopeBandName=MCI_slope -Ssource=“mysourcefile.N1” -t “myOutputfile.dim”

It works!

<parameters>
<lowerBaselineBandName>radiance_9</lowerBaselineBandName>
<upperBaselineBandName>radiance_7</upperBaselineBandName>
<signalBandName>radiance_8</signalBandName>
<lineHeightBandName>MCI</lineHeightBandName>
<slope>true</slope>
<slopeBandName>MCI_slope</slopeBandName>
<maskExpression>NOT l1_flags.LAND_OCEAN AND NOT l1_flags.BRIGHT AND NOT l1_flags.INVALID</maskExpression>
<cloudCorrectionFactor>1.005</cloudCorrectionFactor>
<invalidFlhMciValue>NaN</invalidFlhMciValue> </parameters>

Hi David,

your right, on the command line the preset can not be used. it is currently only a GUI parameter.
On the command line the ‘preset’ parameter is not shown when you type gpt FlhMci -h
The error is that the GUI displays it when doing ‘Display parameters’ or ‘Save Parameters’.
It would be even better if the preset is also supported on the command line.
I’ve put it on the list of our issues (SIIITBX-149).