marpet
August 4, 2021, 1:12pm
2
I’m not aware of another way to preserve the wavelength at the moment.
To simplify your processing chain you could call the mosaic also from Python. Then you have only one call.
How the mosaic could be used is shown here:
I’m trying to mosaic 2 Sentinel-2 tiles using snappy but when I execute this code:
products = jpy.array('org.esa.snap.core.datamodel.Product', 2)
products[0] = ProductIO.readProduct(sourcePath1)
products[1] = ProductIO.readProduct(sourcePath2)
bnames = products[0].getBandNames() #Bands are the same for each product
parameters = HashMap()
parameters.put('variables',bnames)
Mosaic = GPF.createProduct('Mosaic', parameters, products)
I get this error:
RuntimeError: org.esa.snap.core.gpf.…
Or you could execute the Graph XML file as I’ve explained here:
In python you don’t need the XML. here you can use the output of one operator as in input to the next operator.
You can start command line sub-processes to start the processing with gpt, or execute the graph directly as in the following snippet:
import snappy
from snappy import jpy, ProgressMonitor
FileReader = jpy.get_type('java.io.FileReader')
GraphIO = jpy.get_type('org.esa.snap.core.gpf.graph.GraphIO')
Graph = jpy.get_type('org.esa.snap.core.gpf.graph.Graph')
GraphProcessor = jpy.get_type…
See also what the user @xidiandreamseeker wrote further down the thread:
Thanks for your great help, I finally implement batch processing by runing graph from python.
and I set read and write nodes as follows:
graph.getNode(“read”).getConfiguration().getChild(0).setValue(String input1)
graph.getNode(“read(2)”).getConfiguration().getChild(0).setValue(String input2)
graph.getNode(‘write’).getConfiguration().getChild(0).setValue(String write)