ProgressMonitor in snappy

Good afternoon

I’m running snappy in a Jupyter workbook. How do I log the progress of a long GPF chain (that may take many hours)?

I see that…

snappy.ProductIO.writeProduct(Product product, String filePath, String formatName, ProgressMonitor pm)

… takes a ProgressMonitor object, but I can’t work out how to implement one. Does anyone have a working example?

Thanks in advance

There is still something missing in our framework. We already have an issue for it. The output might not be very good even if you pass in a ProgressMonitor.
The following code snippet should create a PM for you which you can pass to the write product method.

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

Thanks for the code. This prints out to the console running Jupyter, but not the notebook itself. Can I catch the output into python to print()?

When you say missing - are you implying that the logging via ProgressMonitor of the SNAP operators is not implemented? I’m really not seeing much logging output.


There is indeed at some point some code missing, at least when using gpt from the command line. If you get output it works this way.
The output depends on the operators you use in your graph.

However, I think we can improve here.