Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
def createProgressMonitor():
    PWPM = jpy.get_type('com.bc.ceres.core.PrintWriterProgressMonitor')
    JavaSystem = jpy.get_type('java.lang.System')
    monitor = PWPM(JavaSystem.out)
    return monitor

pm = createProgressMonitor() 
GPF.writeProduct(target_product , File(<'your/out/directory'>), write_format, incremental, pm)


In this way, Python can be used to extend SNAP by new raster data processor plugins, i.e. operators. As said, operators can be executed from the command-line, or invoked from the SNAP Desktop GUI, and be used as nodes in processing XML graphs.A more comprehensive guideline how to set up such plugins can be found at What to consider when writing an Operator in Python.


Option B: Process a product using custom data computations in Python

...

it = ProductIOPlugInManager.getInstance().getAllReaderPlugIns()
A few more example snippets can also be found in the snap-examples repository.

Python Operator Plugins

...

().getAllReaderPlugIns()
A few more example snippets can also be found in the snap-examples repository.