I would like to process a hundred S2-MSI images following the bulk processing guide, but always have the same error:
Error: [NodeId: ReadOp@sourceProduct] No product reader found for file C:\tmp\in\S2A_MSIL2A_20191026T110141.SAFE
I exported the *.xml from the SNAP-Desktop and adjusted it to process it massively with the processDataset.bat.
What am I doing wrong?
I am not 100% sure but could you try to change the line 50 of the processDataset.bat to something like that:
set procCmd=%gptPath% %graphXmlPath% -t "!targetFile!" -PsourceProducts="!sourceFile!"
I am not 100% familiar with the bat syntax but I think it could help. However I am afraid that all processed output will be overwritten in the same position as the Write node in the graph has no variable defined.
In the case it will overwrite the same file over and over change the line 98 of myGraph.xml as follow:
<file>{targetFile}</file>
and again change the processDataset.bat line 50 to:
set procCmd=%gptPath% %graphXmlPath% -PtargetFile="!targetFile!" -PsourceProducts="!sourceFile!"
Again I am not sure 100% so let me know the outcome!
You were rigth about changing line 98 of myGraph.xml. It was necessary to set a variable.
In the processDataset.bat I have changed:
Line 50: set procCmd=%gptPath% %graphXmlPath% -PtargetFile="!targetFile!" -PsourceProducts="!sourceFile!"
Lines 23 and 28: I “removed” them because they always deleted the last character of the path.
Line 35: I replaced “md” by “mkdir”.
But it does not work. This is the error message:
C:\tmp>processDataset.bat myGraph.xml C:\tmp\in C:\tmp\out res
C:\tmp>setlocal ENABLEDELAYEDEXPANSION
C:\tmp>set gptPath="C:\apps\snap\bin\gpt.exe"
C:\tmp>set graphXmlPath=myGraph.xml
C:\tmp>set sourceDirectory=C:\tmp\in
C:\tmp>set targetDirectory=C:\tmp\out
C:\tmp>set targetFilePrefix=res
C:\tmp>mkdir C:\tmp\out
Ya existe el subdirectorio o el archivo C:\tmp\out.
C:\tmp>for / %F in (S2*.SAFE) do (
echo.
set sourceFile=%~fF
echo Processing !sourceFile!
set targetFile=C:\tmp\out\res_%~nF.dim
set procCmd="C:\apps\snap\bin\gpt.exe" myGraph.xml -PtargetFile="!targetFile!" -PsourceProducts="!sourceFile!"
call !procCmd!
)
C:\tmp>(
echo.
set sourceFile=C:\tmp\in\S2A_MSIL2A_20180713T105621.SAFE
echo Processing !sourceFile!
set targetFile=C:\tmp\out\res_S2A_MSIL2A_20180713T105621.dim
set procCmd="C:\apps\snap\bin\gpt.exe" myGraph.xml -PtargetFile="!targetFile!" -PsourceProducts="!sourceFile!"
call !procCmd!
)
Processing C:\tmp\in\S2A_MSIL2A_20180713T105621.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
done.
Error: [NodeId: Read] The 'file' parameter is not set
It seems that it does not recognise the “file”. Do I have to set the “file”? How can I do that in the script.
I have changed how you recommend, but It gives the same error:
C:\tmp>(
echo.
set sourceFile=c:\tmp\in\S2A_MSIL2A_20191026T110141.SAFE
echo Processing !sourceFile!
set targetFile=C:\tmp\out\out\ll\res_S2A_MSIL2A_20191026T110141.dim
set procCmd="C:\apps\snap\bin\gpt.exe" myGraph.xml -PtargetFile= -PsourceProducts=
call !procCmd!
)
Processing c:\tmp\in\S2A_MSIL2A_20191026T110141.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
done.
Error: [NodeId: Read] The 'file' parameter is not set
Any ideas? Does someone have the same error?
Thank you,
Joshsoj
set procCmd="C:\apps\snap\bin\gpt.exe" myGraph.xml -PtargetFile= -PsourceProducts=
You see that targetFile and sourceProducts are empty.
I am not sure what is the correct syntax to correctly output the parameters. I hope someone will help you with the .bat syntax (as I do not have windows to try it at the moment).