(base) C:\Users\mas108\Downloads\aaa\CA\Sentinel2>for / F in (S2*.SAFE) do (
echo.
set sourceFile=~fF
echo Processing !sourceFile!
set targetFile=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!
)
gpt processDataset.bat resample_s2.xml resample_20m.properties \input \output resampled20m
Error message:
No product reader found for ‘C:\Users\mas108\Downloads\aaa\CA\Sentinel2\resample_s2.xml’
Ok, first you have to know that the graph you are using is not the C2RCC but the Resample. Of course to apply C2RCC to MSI you have to resample first (it could be 20m as you wrote). You will then have to use the resampled product as input in the C2RCC graph. You could do it in one go using a single xml file. The trick is to do the process first in SNAP and then copy the parameters (or save them) into the xml file.
Some threads you can use:
After your xml can be applied to one image using the command line, you can try the .bat file to repeat the process on several images.
gpt processDataset.bat resample_s2.xml resample_20m.properties \input \output resampled20m
This call is not correct. You need to remove the ‘gpt’ at the beginning. gpt is called by the batch file.
You can also do both, resampling and C2RCC processing, in one graph.
How to create graphs is explained here: https://senbox.atlassian.net/wiki/spaces/SNAP/pages/70503590/Creating+a+GPF+Graph
By running the command without gpt, it creates a new folder resampled20 but the algorithm doesnt run. The link you have shared is for running C2RCC but I am in step-1 (resampling data first). KIndly advise.
(base) C:\Users\mas108\Downloads\aaa\CA\Sentinel2>for / F in (S2*.SAFE) do (
echo.
set sourceFile=~fF
echo Processing !sourceFile!
set targetFile=resampled20m_%~nF.dim
set procCmd=“C:\Users\mas108\snap\bin\gpt.exe” resample_s2.xml -e -p resample_20m.properties -t “!targetFile!” “!sourceFile!”
call !procCmd!
)
I do not see in your command line that you are indicating which one is your target product, only your source. I do not see the. xml either. I mean, the gpt command line should be: ./gpt dir/_to your_S2Resampling.xml dir/_to your_source_product dir/_to your_target_product. The S2Resampling.xml will content of the resampling parameters in the xml file.
Your bash file order does not make sense. If you have all well written in your bash, you only need to run it, you do not need to specify anything else.
when i try process resample for sentinel2, it not works, details in below. thanks
Best
Binbin
Case1 error
(binbin2) [bjiang@viz3]~/snap/bin% processDataset.bash resample_s2.xml resample_20m.properties “/home/bjiang/Sentinel2/getOC-master-3/2016woodram/orgin/” “/home/bjiang/Sentinel2/getOC-master-3/2016woodram/orgin/S2A_MSIL1C_20160106T153632_N0201_R111_T19TCJ_20160106T153739.SAFE/C2RCC” resampled20m
zsh: processDataset.bash: command not found…
zsh: command not found: processDataset.bash
Case2 error
(binbin2) [bjiang@viz3]~/snap/bin% ./gpt processDataset.bash resample_s2.xml resample_20m.properties “/home/bjiang/Sentinel2/getOC-master-3/2016woodram/orgin/” “/home/bjiang/Sentinel2/getOC-master-3/2016woodram/orgin/S2A_MSIL1C_20160106T153632_N0201_R111_T19TCJ_20160106T153739.SAFE/C2RCC” resampled20m
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
SEVERE: org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller: The environment variable LD_LIBRARY_PATH does not contain the current folder ‘.’. Its value is ‘/opt/modules/centos7/openslide/3.4.1/lib:/opt/modules/centos7/gcc/7.3.0/lib:/opt/modules/centos7/gcc/7.3.0/lib64:/opt/modules/centos7/libs:/opt/modules/centos7/libX’.
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
WARNING: org.esa.snap.core.util.EngineVersionCheckActivator: A new SNAP version is available for download.
Currently installed 7.0, available is 8.0.0.
Please visit http://step.esa.int
org.esa.snap.core.gpf.OperatorException: No product reader found for ‘/nfs3-home/bjiang/snap/bin/resample_s2.xml’
at org.esa.snap.core.gpf.main.DefaultCommandLineContext.readProduct(DefaultCommandLineContext.java:57)
at org.esa.snap.core.gpf.main.CommandLineTool.readProduct(CommandLineTool.java:521)
at org.esa.snap.core.gpf.main.CommandLineTool.addProduct(CommandLineTool.java:466)
at org.esa.snap.core.gpf.main.CommandLineTool.getSourceProductMap(CommandLineTool.java:454)
at org.esa.snap.core.gpf.main.CommandLineTool.runOperator(CommandLineTool.java:295)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:284)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:65)
at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:57)
Error: No product reader found for ‘/nfs3-home/bjiang/snap/bin/resample_s2.xml’
zsh: processDataset.bash: command not found…
zsh: command not found: processDataset.bash
tells you that the command (the file is not found). Your working directory seems to be /snap/bin.
You can save the file there. or you change the current working directory to the folder where the bash file is already located. Then the command should work.
In your second case you call gpt. But the parameters do not match the expected values.