Hello,
I want to do S1-DEM generation by using GPT.
müllberg.properties (643 Bytes)
Müllberg0801_DEM2.xml (7.8 KB)
This are the files I want to use. Which comands do I need in the command line and how to get the properties in the graph?
Hello,
I want to do S1-DEM generation by using GPT.
müllberg.properties (643 Bytes)
Müllberg0801_DEM2.xml (7.8 KB)
This are the files I want to use. Which comands do I need in the command line and how to get the properties in the graph?
The following page should help:
https://senbox.atlassian.net/wiki/spaces/SNAP/pages/70503475/Bulk+Processing+with+GPT
Hello marpet,
I know this page allready. I tried to adapt this example:
müllberg.properties (643 Bytes)
Müllberg0801_DEMoneExport.xml (7.0 KB)
processDataset.bat (1.8 KB)
and I use this command in the cmd: X:\Master\SNAP\Test>processDataset.bat Müllberg0801_DEMoneExport.xml müllberg.properties X:\Master\SNAP\Test\Slave.zip X:\Master\SNAP\Test\out
I get this answer in the cmd;
X:\Master\SNAP\Test>processDataset.bat Müllberg0801_DEMoneExport.xml müllberg.properties X:\Master\SNAP\Test\Slave.zip X:\Master\SNAP\Test\out
X:\Master\SNAP\Test>setlocal ENABLEDELAYEDEXPANSION
X:\Master\SNAP\Test>set gptPath=“X:\Master\SNAP\snap\S\bin\gpt.exe”
X:\Master\SNAP\Test>set graphXmlPath=Müllberg0801_DEMoneExport.xml
X:\Master\SNAP\Test>set parameterFilePath=müllberg.properties
X:\Master\SNAP\Test>set sourceDirectory=X:\Master\SNAP\Test\Slave.zip
X:\Master\SNAP\Test>set targetDirectory=X:\Master\SNAP\Test\out
X:\Master\SNAP\Test>set targetFilePrefix=
X:\Master\SNAP\Test>md X:\Master\SNAP\Test\out
A subdirectory or file X:\Master\SNAP\Test\out already exists.
X:\Master\SNAP\Test>for / %F in (S2*.SAFE) do (
echo.
set sourceFile=%~fF
echo Processing !sourceFile!
set targetFile=X:\Master\SNAP\Test\out_%~nF.dim
set procCmd=“X:\Master\SNAP\snap\S\bin\gpt.exe” Müllberg0801_DEMoneExport.xml -e -p müllberg.properties -t
call !procCmd!
)
the target folder is created, but empty
I want that all settings (Source product, output…) can be done in the .properties file without extra settings in the cmd
In this case you need to add a read operator:
<node id="ReadNode">
<operator>Read</operator>
<sources/>
<parameters>
<file>${gpt.sourceProduct1}</file>
</parameters>
</node>
You have the property already defined in the properties file.
gpt.sourceProduct1=X:\Master\SNAP\CMLtestMaster\S1A_IW_SLC__1SDV_20181203T170720_20181203T170747_024864_02BCF3_DB47.zip
A write node, similar to the read node, needs to be added for the output.
Thanks for your help!
But how does the batch file has to look like when I only want to run the graph with the property file?
Probably similar to the attached batch file. It still can have errors. I haven’t tried it.
But it should be close to the final solution, at least.
processDataset_updated.bat (989 Bytes)
Thank you!
now I want to do bulk processing. therefore I want the batch file to run through all zip files in a folder and do the processing wiht the parameter file. I want to hand the actual SAR image to the xml file as a parameter. I alwas get an errormessage, that the specified path is invalid, but I checked that it is correct.
My files are:
B.bat (1.9 KB)
DEM1601.xml (7.4 KB)
P.properties (460 Bytes)
In the CMD I get this error:
X:\Master\SNAP\snap\S\bin>B.bat X:\Master\SNAP\Läuft1601\DEM1601.xml X:\Master\SNAP\Läuft1601\P.properties X:\Master\SNAP\CMLtestSlave X:\Master\SNAP\output DEM
A subdirectory or file X:\Master\SNAP\output already exists.
Processing X:\Master\SNAP\CMLtestSlave\S1A_IW_SLC__1SDV_20180513T170713_20180513T170740_021889_025CF5_B31B.zip
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
java.io.FileNotFoundException: ${gpt.slave}=X:\Master\SNAP\CMLtestSlave\S1A_IW_SLC__1SDV_20180513T170713_20180513T170740_021889_025CF5_B31B.zip (The specified path is invalid)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at org.esa.snap.core.gpf.main.DefaultCommandLineContext.createReader(DefaultCommandLineContext.java:101)
at com.bc.ceres.metadata.MetadataResourceEngine.readResource(MetadataResourceEngine.java:94)
at org.esa.snap.core.gpf.main.CommandLineTool.getRawParameterMap(CommandLineTool.java:485)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraph(CommandLineTool.java:337)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:287)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:188)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:121)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.esa.snap.runtime.Launcher.lambda$run$0(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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:62)
at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:101)
at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:16)
Error: ${gpt.slave}=X:\Master\SNAP\CMLtestSlave\S1A_IW_SLC__1SDV_20180513T170713_20180513T170740_021889_025CF5_B31B.zip (The specified path is invalid)
At line 57 in your batch file you have an error:
set procCmd=%gptPath% %graphXmlPath% -e -p %parameterFilePath% -e -p ${gpt.slave}="!sourceFile!" -t “!targetFile!”
Probably you only need to remove -e -p ${gpt.slave}=
Then I get this error :
Error: [NodeId: Read(2)] Specified ‘file’ [${gpt.slave}] does not exist.
In the parameterfile I have to use \ in the file path. Do I have to use \ or \\ in the path in the cmd?
No, actually not.
Could be that you only need to remove the -e and change -p ${gpt.slave}="!sourceFile!"
to
-Pgpt.slave="!sourceFile!"
Thank you so much!
now it is working
Here the files:
B.bat (1.9 KB)
DEM1601.xml (7.5 KB)
P.properties (463 Bytes)
With this comand:
X:\Master\SNAP\snap\S\bin>B.bat X:\Master\SNAP\Läuft1601\DEM1601.xml X:\Master\SNAP\Läuft1601\P.properties X:\Master\SNAP\CMLtestSlave X:\Master\SNAP\output DEM