Mimic progress monitoring in Snappy

Hi again!

I’m wondering if anyone has any implementations of monitoring progress of processors within snappy?

My usual goto back when I used to do this was watch Java VisualVM and you could tell which processor was working. Is there a nice way I can get an output from my python code to monitor this?

I’d like to be able to get a % of progress through, almost mimicking SNAPs progress bar.

Many thanks!

You could add a ProgressMonitor when writing the product.
As computation is only done when the data is written it is sufficient to monitor this.

ProductIO.writeProduct(Product, Path, Format, ProgressMonitor)

An new PM could be created like this:

PrintPM = jpy.get_type('com.bc.ceres.core.PrintWriterProgressMonitor')
# or a more concise implementation
ConcisePM = jpy.get_type('com.bc.ceres.core.PrintWriterConciseProgressMonitor')
System = jpy.get_type('java.lang.System')
pm = PrintPM(System.out)
ProductIO.writeProduct(resultProduct, outPath, "NetCDF-CF", pm)

This should print the progress.

1 Like