Is there any possibility of running sen2coral from python so i can use it in batch mode for multiple images?

It should work using snappy. Please see:

Another option for running SNAP in batch mode is the Graph Processing Tool (GPT) that is included in the SNAP installation.

Thank you for your answer. One more question but how i can call the plugin of sen2coral since it is a build plugin (you call it from IntelliJ IDEA programm)?

If you have built it properly, then you will have some .nbm files in the target/netbeans-site folder of the sen2coral-kit. You can use these files for installing the sen2coral plugin in SNAP: Tools->Plugin->Downloaded->AddPlugins…

If you prefer, you can also execute it directly from IntelliJ.

1 Like

I have build the application and i have installed the plugin in snap. I have installed jython.

I was trying to implement this code for the Depth Invariant Indices :
import snappy
from snappy import *
from snappy import GPF
from snappy import jpy
from snappy import HashMap
from snappy import ProductIO

HashMap = jpy.get_type(‘java.util.HashMap’)

parameters = HashMap()
parameters.put(‘sourceBands’, ‘B2,B3’)
parameters.put(‘sameBottomVectors’, ‘deep’)

How i can call in this script the Depth Invariant Indices?


the command for calling DepthInvariant should be:


Thanks for your response. I tried your idea but i get the following error

Traceback (most recent call last):
File “F:\sen2coral\sen2cora;.py”, line 18, in
RuntimeError: org.esa.snap.core.gpf.OperatorException: Unknown operator ‘DepthInvariantIndicesOp’. Note that operator aliases are case sensitive.

Any ideas?

Have you checked that the sen2coral plugin is properly installed? If you open SNAP Desktop, can you see the Sen2Coral operators in the menu?

yeap i can see the menu

And did you add the plugin via Menu->Tools->Plugins… in your SNAP installation or are you running it from IntelliJ?

I added my plugin through Menu->Tools->Plugins .

And if you execute the command:

gpt DepthInvariantIndicesOp -h

Is the operator found?

yeap. I get the following.

WARNING: org.esa.snap.core.util.ServiceFinder: Can't search for SPIs, not a directory: \snap-desktop-plugins
INFO: org.esa.snap.python.gpf.PyOperatorSpi: Python operator 'py_sambuca_snap_op' registered (Python module: 'sambuca_snap_op', class: 'sambuca_snap_op', root: 'C:\Users\user\AppData\Roaming\SNAP\modules\org-esa-sen2coral-sen2coral-inversion.jar')
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
  gpt DepthInvariantIndicesOp [options]

  DepthInvariantIndicesOp algorithm

Source Options:
  -SsourceProduct=<file>    Sets source 'sourceProduct' to <filepath>.
                            This is a mandatory source.

Parameter Options:
  -PdeepWaterVector=<string>                  Deep water area
  -PsameBottomVectors=<string>                Same bottom areas
  -PsourceBands=<string,string,string,...>    The list of source bands.

Graph XML Format:
  <graph id="someGraphId">
    <node id="someNodeId">

I also tried from another post the following code

registry = GPF.getDefaultInstance().getOperatorSpiRegistry()

It seems to work. Does it make any sense?

It is strange, that should be done automatically since SNAP version 5.0. See for example:

hello obarrilero, do you have a tutuorial to instal plugin sen2coral? . thankyou

hello obariello, can i see step by step instal sen2coral in Windows? i was see tutorial in github.but its not work. thankyou for your respon