java.lang.NullPointerException during clusters analysis

Hi,

While trying to start an EM or K-Means clusters analysis I am facing this error at the second I try launching the process. Is there any fix for this problem? it only seems to happen when manipulating subsets, but running this process on a complete image is way too heavy.

This is performed on subset of a 4 bands iCOR corrected S2 picture

java.lang.NullPointerException
at org.esa.snap.core.datamodel.GcpGeoCoding.transferGeoCoding(GcpGeoCoding.java:110)
at org.esa.snap.core.datamodel.SceneFactory.transferGeoCoding(SceneFactory.java:57)
at org.esa.snap.core.datamodel.SceneFactory.access$000(SceneFactory.java:27)
at org.esa.snap.core.datamodel.SceneFactory$ProductScene.transferGeoCodingTo(SceneFactory.java:111)
at org.esa.snap.core.datamodel.Product.transferGeoCodingTo(Product.java:867)
at org.esa.snap.core.util.ProductUtils.copyGeoCoding(ProductUtils.java:1155)
at org.esa.snap.cluster.EMClusterOp.initialize(EMClusterOp.java:125)
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.core.gpf.ui.DefaultSingleTargetProductDialog.createTargetProduct(DefaultSingleTargetProductDialog.java:137)
[catch] at org.esa.snap.core.gpf.ui.SingleTargetProductDialog.onApply(SingleTargetProductDialog.java:131)
at org.esa.snap.ui.AbstractDialog.lambda$initUI$6(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)

Thanks for reporting this issue. This will be fixed with the next release.

Have you added a GCP based GeoCoding? Actually, S2 data has a CRS based GeoCoding.
However, without the GCP Geocoding it should work. You can try to reproject the data or you can create a pixel-based GeoCoding.
With the Band Maths create a ‘latitude’ and a ‘longitude’ band. As expression use ‘LAT’ respectively ‘LON’.
With Tools / Attache Pixel GeoCoding you can activate this GeoCoding.
Afterwards, the clustering should work.

Indeed, I have used a few GCPs in my data. Should this be avoided? I was hoping to limit the spatial error of the S2 data.

I am not familiar with the different types of geocoding. If I understand correctly, you are suggesting to reproject the data after attaching my GCPs in order to go back to a geocoding format compatible with the clustering algorythms?

Arthur

Yes, that’s right. Either you don’t use the GCPs or you reproject after the GCPs are attached.