I tried with one product and worked perfectly (and faster than I expected) but what should I do if I need to ‘extend’ this procedure to 20 data or more? There is something like an iteration or a loop to do?
If you want to do the processing on multiple products you have to options.
You can use a command line script which iterates your input data.
This is described here:
Probably you need to update the head of the loop so that your Sentinel-1 is considered:
You should also rename the property file. The name should match the content and you not resampling to 20m.
:: double '%' in batch file and only a single '%' on command line
:: '/D' is for directories like Sentinel data. Remove '/D' when you open files.
for /D /R %sourceDirectory% %%F in (S2*.SAFE) do (
It might be helpful if you attach the modified batch script.
Also, it would be good if you share the output of the script not as image but as text.
I just tried it and for it iterates of my data.
That’s my command line call: H:\_other\bulkProcess>processDataset.bat resample_s2.xml resample_20m.properties H:\SENTINEL2\sharp_shadow H:\_other\bulkProcess\out resampled20m
And that’s the output
H:\_other\bulkProcess>setlocal ENABLEDELAYEDEXPANSION
H:\_other\bulkProcess>set gptPath="C:\Program Files\snap\bin\gpt.exe"
H:\_other\bulkProcess>set graphXmlPath=resample_s2.xml
H:\_other\bulkProcess>set parameterFilePath=resample_20m.properties
H:\_other\bulkProcess>set sourceDirectory=H:\SENTINEL2\sharp_shadow
H:\_other\bulkProcess>if w == \ set sourceDirectory=H:\SENTINEL2\sharp_shado
H:\_other\bulkProcess>set targetDirectory=H:\_other\bulkProcess\out
H:\_other\bulkProcess>if t == \ set targetDirectory=H:\_other\bulkProcess\ou
H:\_other\bulkProcess>set targetFilePrefix=resampled20m
H:\_other\bulkProcess>md H:\_other\bulkProcess\out
Ein Unterverzeichnis oder eine Datei mit dem Namen "H:\_other\bulkProcess\out" existiert bereits.
H:\_other\bulkProcess>for / %F in (S2*.SAFE) do (
echo.
set sourceFile=%~fF
echo Processing !sourceFile!
set targetFile=H:\_other\bulkProcess\out\resampled20m_%~nF.dim
set procCmd="C:\Program Files\snap\bin\gpt.exe" resample_s2.xml -e -p resample_20m.properties -t "!targetFile!" "!sourceFile!"
call !procCmd!
)
H:\_other\bulkProcess>(
echo.
set sourceFile=H:\SENTINEL2\sharp_shadow\S2A_MSIL1C_20211024T145311_N0301_R082_T22VER_20211024T170119.SAFE
echo Processing !sourceFile!
set targetFile=H:\_other\bulkProcess\out\resampled20m_S2A_MSIL1C_20211024T145311_N0301_R082_T22VER_20211024T170119.dim
set procCmd="C:\Program Files\snap\bin\gpt.exe" resample_s2.xml -e -p resample_20m.properties -t "!targetFile!" "!sourceFile!"
call !procCmd!
)
Processing H:\SENTINEL2\sharp_shadow\S2A_MSIL1C_20211024T145311_N0301_R082_T22VER_20211024T170119.SAFE
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
Executing processing graph
At the end you see that it is finding the product S2A_MSIL1C_20211024T145311_N0301_R082_T22VER_20211024T170119.SAFE
For Sentinel-1 data it works the same. I just changed in the loop header S2 to S1 and used, of course, a different input directory.
This message is okay. It results from the ‘md’ command which tries to create the target directory. If it already exists this message is prompted but the script executes normally.
In my output you can see:
Ein Unterverzeichnis oder eine Datei mit dem Namen “H:_other\bulkProcess\out” existiert bereits.
Error: Not able to write product file: 'C:\Program Files\snap\bin\"C:\gpt_processing_SNAP\out\S1A_IW_GRDH_1SDV_20150712T174032_20150712T174057_006781_0091C2_E940_finalprod.dim"'
I don’t know how to resolve this problem! Is maybe something wrong in my graph?
Yes, the output file path needs to be updated for the different inputs. You cannot specify a constant path.
This is explained in the section “Using a Graph Created by the GraphBuilder” in the document you have linked.