I would like to realise a script for GPT, which reads a S2 L1C image and extract certain bands over a certain area of interest.
If I operate through the GUI, I perform:
a) subset providing bands and geographical area bounding box
b) export
So I built a GPT xml script with the following operators:
- Read
- Subset (with settings taken from previous bullet a)
- Write
Every time I launch the script I have an error: “Error: org/esa/snap/framework/datamodel/GeoCoding”
Then I tried with:
- Read
- BandMath simply copying the needed bands
- Reproject including my area of interest
- Write
I’ve then the same error. This is the log with the -e command:
java.lang.NoClassDefFoundError: org/esa/snap/framework/datamodel/GeoCoding
at org.esa.s2tbx.dataio.s2.ortho.S2OrthoProduct60MReaderPlugIn.createReaderInstance(S2OrthoProduct60MReaderPlugIn.java:44)
at org.esa.snap.core.dataio.ProductIO.getProductReaderForInput(ProductIO.java:277)
at org.esa.snap.core.gpf.common.ReadOp.initialize(ReadOp.java:88)
at org.esa.snap.core.gpf.internal.OperatorContext.initializeOperator(OperatorContext.java:499)
at org.esa.snap.core.gpf.internal.OperatorContext.getTargetProduct(OperatorContext.java:278)
at org.esa.snap.core.gpf.Operator.getTargetProduct(Operator.java:359)
at org.esa.snap.core.gpf.graph.NodeContext.initTargetProduct(NodeContext.java:74)
at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:195)
at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:178)
at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:178)
at org.esa.snap.core.gpf.graph.GraphContext.initOutput(GraphContext.java:162)
at org.esa.snap.core.gpf.graph.GraphContext.(GraphContext.java:91)
at org.esa.snap.core.gpf.graph.GraphContext.(GraphContext.java:64)
at org.esa.snap.core.gpf.graph.GraphProcessor.executeGraph(GraphProcessor.java:130)
at org.esa.snap.core.gpf.main.DefaultCommandLineContext.executeGraph(DefaultCommandLineContext.java:84)
at org.esa.snap.core.gpf.main.CommandLineTool.executeGraph(CommandLineTool.java:502)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraph(CommandLineTool.java:350)
at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:249)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:150)
at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:122)
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$12(Launcher.java:55)
at org.esa.snap.runtime.Engine.runClientCode(Engine.java:186)
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)
Caused by: java.lang.ClassNotFoundException: org.esa.snap.framework.datamodel.GeoCoding
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 37 more
Error: org/esa/snap/framework/datamodel/GeoCoding
Then, just to make a test, I removed the Reproject step 3, leaving only the band math. Again the same error occurs.
Finally I tried to build the last one (with only bandmath) on the Graph Builder and noticed that if I configure the Read module to read the image in native resolution the graph builder gives a warning and SNAP become unusable untill I close the Graph Builder. If I select one resolution it works.
Maybe there is a parameter for the Read module to ask for a specific resolution?
Regards