With the same files i ran S2 MSI and it went perfectly without any error. How to solve this? I have gone through some past posts but unfortunately I could not find a solution to my issue Even after applying the valid pixel expression mask, nothing is working for L8. Please let me know what to do.
I’m not sure what’s wrong but it seems to be related to the source directory. Maybe the files to loop over are not found.
I just tried a processDataset.bat (a bit simplified) and it worked.
@echo off
:: enable delayed expansion - used to resolve variable in loop
:: variable has to be used with '!' instead of '%'
setlocal ENABLEDELAYEDEXPANSION
::::::::::::::::::::::::::::::::::::::::::::
:: User Configuration
::::::::::::::::::::::::::::::::::::::::::::
:: adapt this path to your needs
set gptPath="C:\Program Files\esa-snap\bin\gpt.exe"
::::::::::::::::::::::::::::::::::::::::::::
:: Command line handling
::::::::::::::::::::::::::::::::::::::::::::
:: first parameter is a path to the graph xml
set graphXmlPath=%1
:: second parameter is a path to a parameter file
::set parameterFilePath=%2
:: use third parameter for path to source products
set sourceDirectory=%2
:: if sourceDirectory ends with '\' remove it
if %sourceDirectory:~-1%==\ set sourceDirectory=%sourceDirectory:~0,-1%
:: use fourth parameter for path to target products
set targetDirectory=%3
:: if targetDirectory ends with '\' remove it
if %targetDirectory:~-1%==\ set targetDirectory=%targetDirectory:~0,-1%
:: the fifth parameter is a file prefix for the target product name,
:: typically indicating the type of processing
set targetFilePrefix=%5
:: Create the target directory
md %targetDirectory%
::::::::::::::::::::::::::::::::::::::::::::
:: Main processing
::::::::::::::::::::::::::::::::::::::::::::
:: double '%' in batch file and only a single '%' on command line::::
:: '/D' is for directories like Sentinel data. Remove '/D' when you open files.
:: '/R' <directory> specifies the directory which the loop will walk recursively.
:: Iterating over *.nc files within the source directory can be done simpler:
:: for %%F in (%sourceDirectory%\*.nc) do (
for %%F in (%sourceDirectory%\S3*.zip) do (
echo.
:: '~fF' means absolute path of 'F'
set sourceFile=%%~fF
echo Processing !sourceFile!
:: '~nF' means filename without extension of 'F'
set targetFile=%targetDirectory%\%targetFilePrefix%_%%~nF.dim
:: set procCmd=%gptPath% %graphXmlPath% -e -p %parameterFilePath% -t "!targetFile!" "!sourceFile!"
set procCmd=%gptPath% %graphXmlPath% -e -t "!targetFile!" "!sourceFile!"
echo Command: !procCmd!
call !procCmd!
)
using with: processDataset.bat D:\_graphXML\graphC2RCC_OLCI.xml D:\EOData\S3\OLCI\Anti-Meridian D:\_temp\out C2RCC
And the output is
d:\_graphXML>processDataset.bat D:\_graphXML\graphC2RCC_OLCI.xml D:\EOData\S3\OLCI\Anti-Meridian D:\_temp\out C2RCC
d:\_graphXML>setlocal ENABLEDELAYEDEXPANSION
d:\_graphXML>set gptPath="C:\Program Files\esa-snap\bin\gpt.exe"
d:\_graphXML>set graphXmlPath=D:\_graphXML\graphC2RCC_OLCI.xml
d:\_graphXML>set sourceDirectory=D:\EOData\S3\OLCI\Anti-Meridian
d:\_graphXML>if n == \ set sourceDirectory=D:\EOData\S3\OLCI\Anti-Meridia
d:\_graphXML>set targetDirectory=D:\_temp\out
d:\_graphXML>if t == \ set targetDirectory=D:\_temp\ou
d:\_graphXML>set targetFilePrefix=
d:\_graphXML>md D:\_temp\out
A subdirectory or file D:\_temp\out already exists.
d:\_graphXML>for %F in (D:\EOData\S3\OLCI\Anti-Meridian\S3*.zip) do (
echo.
set sourceFile=%~fF
echo Processing !sourceFile!
set targetFile=D:\_temp\out\_%~nF.dim
set procCmd="C:\Program Files\esa-snap\bin\gpt.exe" D:\_graphXML\graphC2RCC_OLCI.xml -e -t "!targetFile!" "!sourceFile!"
echo Command: !procCmd!
call !procCmd!
)
d:\_graphXML>(
echo.
set sourceFile=D:\EOData\S3\OLCI\Anti-Meridian\S3A_OL_1_EFR____20230708T220131_20230708T220431_20230709T225332_0179_101_015_1800_PS1_O_NT_003.zip
echo Processing !sourceFile!
set targetFile=D:\_temp\out\_S3A_OL_1_EFR____20230708T220131_20230708T220431_20230709T225332_0179_101_015_1800_PS1_O_NT_003.dim
set procCmd="C:\Program Files\esa-snap\bin\gpt.exe" D:\_graphXML\graphC2RCC_OLCI.xml -e -t "!targetFile!" "!sourceFile!"
echo Command: !procCmd!
call !procCmd!
)
Processing D:\EOData\S3\OLCI\Anti-Meridian\S3A_OL_1_EFR____20230708T220131_20230708T220431_20230709T225332_0179_101_015_1800_PS1_O_NT_003.zip
Command: "C:\Program Files\esa-snap\bin\gpt.exe" D:\_graphXML\graphC2RCC_OLCI.xml -e -t "D:\_temp\out\_S3A_OL_1_EFR____20230708T220131_20230708T220431_20230709T225332_0179_101_015_1800_PS1_O_NT_003.dim" "D:\EOData\S3\OLCI\Anti-Meridian\S3A_OL_1_EFR____20230708T220131_20230708T220431_20230709T225332_0179_101_015_1800_PS1_O_NT_003.zip"
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
done.