Calling a batch process from the command line with gpt

Hi,

Is it possible to use the command line ~/snap/bin/gpt tool to call batch processes (a processing of more than one product with the same graph) as you would do on the GUI (Tools > Batch Processing)?

I mean is there an operator for that (I can’t see anything related to batch processing when I call gpt but maybe I’m missing it)?

Thanks.

You would have to create your own script to do that

2 Likes

There is an example for doing this. It is still for BEAM. But you should be able to apply it on SNAP.

1 Like

Hi, I have some slc products in my HPC cluster and I want to do topsar split for all the slc files by batch processing.
what is the parameter file mentioned in processDataset.bash (Unix). I have set the path to xml, source and target files but unable to understand parameter file path.

The parameter file is the file named case2r.properties in the example. It is a simple text file containing name-value pairs. It provides the values of the parameters used in the XML file.
Is the “Example Usage”-section not clear enough. Do you think it should be extended?

I am getting an error while running by batch script. The xml file, parameter file, batch script are in the same folder.

I have updated only two values in .bat file

  1. location of gpt.bat
  2. file extension in the for loop from *.N1 to *.zip

I run this in command prompt as an admin
C:\WINDOWS\system32>SplitDataset.bat Split.xml Split.properties “E:\Flood\Data_Collection\S1_SLC\Top” “E:\Flood\Data_Collection\S1_SLC\Top_Output” Split
‘SplitDataset.bat’ is not recognized as an internal or external command,
operable program or batch file.

Split.xml (415 Bytes)
Split.properties (40 Bytes)
SplitDataset.bat (1.8 KB)

Is your SplitDataset.bat really located in C:\WINDOWS\system32? At least the message means that SplitDataset.bat cannot be found.

Oh, I guess I need to enter the directory where all the files(Split.xml, Split.properties, SplitDataset.bat) are there. I will try it.

Thank you marpet.

Hi marpet,
I have the run cmd as an administrator mode and enter the proper location where the files are kept. The following message is shown.

E:\Flood\Data_Collection\S1_SLC>SplitDataset.bat Split.xml Split.properties “E:\Flood\Data_Collection\S1_SLC\Top” “E:\Flood\Data_Collection\S1_SLC\Top_Output” Split
The syntax of the command is incorrect.

Thanking you,

Dear marpet.
the location of gpt.bat is different in my PC. So I changed it to C:\Program Files\S1TBX where my gpt.bat is there. Now the following error is occured even though I specify the firstBurstIndex parameter in the Split.properties file.

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
org.esa.beam.framework.gpf.graph.GraphException: Operator ‘TOPSARSplitOp’: Unknown element ‘firstBurstIndex’
at org.esa.beam.framework.gpf.graph.NodeContext.initTargetProduct(NodeContext.java:76)
at org.esa.beam.framework.gpf.graph.GraphContext.initNodeContext(GraphContext.java:195)
at org.esa.beam.framework.gpf.graph.GraphContext.initNodeContext(GraphContext.java:178)
at org.esa.beam.framework.gpf.graph.GraphContext.initOutput(GraphContext.java:162)
at org.esa.beam.framework.gpf.graph.GraphContext.(GraphContext.java:91)
at org.esa.beam.framework.gpf.graph.GraphContext.(GraphContext.java:64)
at org.esa.beam.framework.gpf.graph.GraphProcessor.executeGraph(GraphProcessor.java:123)
at org.esa.beam.framework.gpf.main.DefaultCommandLineContext.executeGraph(DefaultCommandLineContext.java:84)
at org.esa.beam.framework.gpf.main.CommandLineTool.executeGraph(CommandLineTool.java:529)
at org.esa.beam.framework.gpf.main.CommandLineTool.runGraph(CommandLineTool.java:377)
at org.esa.beam.framework.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:263)
at org.esa.beam.framework.gpf.main.CommandLineTool.run(CommandLineTool.java:170)
at org.esa.beam.framework.gpf.main.CommandLineTool.run(CommandLineTool.java:121)
at org.esa.beam.framework.gpf.main.GPT.run(GPT.java:57)
at org.esa.beam.framework.gpf.main.GPT.main(GPT.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.bc.ceres.launcher.Launcher.launch(Launcher.java:154)
at com.bc.ceres.launcher.Launcher.main(Launcher.java:56)
Caused by: org.esa.beam.framework.gpf.OperatorException: Operator ‘TOPSARSplitOp’: Unknown element ‘firstBurstIndex’
at org.esa.beam.framework.gpf.internal.OperatorContext.injectConfiguration(OperatorContext.java:1099)
at org.esa.beam.framework.gpf.internal.OperatorContext.initializeOperator(OperatorContext.java:491)
at org.esa.beam.framework.gpf.internal.OperatorContext.getTargetProduct(OperatorContext.java:272)
at org.esa.beam.framework.gpf.Operator.getTargetProduct(Operator.java:323)
at org.esa.beam.framework.gpf.graph.NodeContext.initTargetProduct(NodeContext.java:74)
… 20 more
Caused by: com.bc.ceres.binding.ConversionException: Unknown element ‘firstBurstIndex’
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.beam.framework.gpf.internal.OperatorContext.configureOperator(OperatorContext.java:1115)
at org.esa.beam.framework.gpf.internal.OperatorContext.injectConfiguration(OperatorContext.java:1095)
… 24 more

Error: Operator ‘TOPSARSplitOp’: Unknown element ‘firstBurstIndex’