Error for GLCM from an output of BandMath

Hi all,
I am working on a time series of Sentinel-1 dual-pol images and I would like to do the following processing.

Step 1: Read --> Subset --> ThermalNoiseRemoval --> Calibration --> Speckle Filter --> Write

Step 2: Read --> BandMaths (1) --> BandMaths (2) --> Write
BandMaths (1): if Sigma0_HH > 0.3 then 0.3 else Sigma0_HH
BandMaths (2): if newBand > .0001 then newBand else 0.0001
*for this step I want to replace all values above 0.3 with 0.3, and all below 0.0001 with 0.0001.

Step 3: Read --> Import-Vector -->Land-Sea-Mask --> Write

Step 4: Read --> GLCM --> Write

Step 5: Read --> Terrain Correction --> Write

Steps 1 to 3 work great, but I am unable to use images that have been through BandMaths processing for the creation of a GLCM.
When I run GLCM I get the following error:

A problem occured during the target product initialisation.
Type: Operator Exception
Message: java.lang.NullPointerException

org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:432)
at org.esa.snap.raster.gpf.texture.GLCMOp.initialize(GLCMOp.java:211)
at org.esa.snap.core.gpf.internal.OperatorContext.initializeOperator(OperatorContext.java:486)
at org.esa.snap.core.gpf.internal.OperatorContext.getTargetProduct(OperatorContext.java:273)
at org.esa.snap.core.gpf.Operator.getTargetProduct(Operator.java:387)
at org.esa.snap.core.gpf.GPF.createProductNS(GPF.java:318)
at org.esa.snap.core.gpf.GPF.createProduct(GPF.java:293)
at org.esa.snap.core.gpf.GPF.createProduct(GPF.java:272)
at org.esa.snap.graphbuilder.rcp.dialogs.SingleOperatorDialog.createTargetProduct(SingleOperatorDialog.java:175)
[catch] at org.esa.snap.graphbuilder.rcp.dialogs.SingleOperatorDialog.onApply(SingleOperatorDialog.java:291)
at org.esa.snap.ui.AbstractDialog.lambda$initUI$9(AbstractDialog.java:519)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

GLCM works fine on non bandmath-ed images though.

Any help would be very much appreciated!

Cheers!

Update! It works on SNAP 4.0!

But not in graph builder

It works in version 4 but not in 5 and 6?

Yep! I tried in 5.0 and 6.0, had to go back to 4.0.

I’m sorry to here this and my apologies for the inconvenience, but thanks for lettings us know.
I’ve noted this, so that the responsible developers can take care of it in the future.
https://senbox.atlassian.net/browse/SNAP-900

Thank you so much! :slight_smile:

Hi Marco,

Still it’s not possible to use GLCM in gpt as the middle product, it gives the following error, However only GLCM it works fine

Read ----> GLCM—>Write

But in this way,

image

Gives the following error,

org.esa.snap.core.gpf.OperatorException: 355284
at org.esa.snap.core.gpf.graph.GraphProcessor$GPFImagingListener.errorOccurred(GraphProcessor.java:363)
at com.sun.media.jai.util.SunTileScheduler.sendExceptionToListener(SunTileScheduler.java:1646)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:921)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:407)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:393)
at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:73)
at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at com.sun.media.jai.util.RequestJob.compute(SunTileScheduler.java:247)
at com.sun.media.jai.util.WorkerThread.run(SunTileScheduler.java:468)
Caused by: org.esa.snap.core.gpf.OperatorException: 355284
at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:415)
at org.esa.snap.raster.gpf.texture.GLCMOp.computeTileStack(GLCMOp.java:501)
at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeRect(OperatorImageTileStack.java:116)
at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeTile(OperatorImageTileStack.java:85)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
… 11 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 355284
at org.esa.snap.core.datamodel.ProductData$Float.getElemDoubleAt(ProductData.java:2440)
at org.esa.snap.raster.gpf.texture.GLCMOp.computeQuantizedImages(GLCMOp.java:791)
at org.esa.snap.raster.gpf.texture.GLCMOp.computeTileStack(GLCMOp.java:479)
… 14 more

Error: 355284

I think the problem is, GLCM operator couldn’t read the re-sample product form the fly.

Thanks for the report Falah.
I’ve added this to our issue tracker.

https://senbox.atlassian.net/browse/SNAP-1237

I guess to work around this issue you need to first write the result of the resampling and in a second step you can do the GLCM.

1 Like

GLCM on band math-ed products works great for me now (SNAP 7.0), thank you so much!