java.lang.NullPointerException when using Speckle Filtering Operator on Beam/DIMAP file

Hi there,

I am trying to replicate an exercise that has been already designed using the manual approach in SNAP with python in Jupyter Notebooks. The exercise is on S1 data and so far I have performed calibration and subsetting and the workflow has been smooth, but when I try to use the speckle filter operator it returns a java.lang.NullPointerException. I’m using a fresh installation of SNAP 6.0 with an integration snappy with Anaconda 2.

I’ve seen user kedziorm had a similar problem with the calibration operator and I’ve checked the recommendations from here:https://forum.step.esa.int/t/java-lang-nullpointerexception-when-using-calibration-operator-on-beam-dimap-file/3099/7. However, I seem to have none of these problems. It also seems that the Speckle Filtering Operator has been updated recently.

This piece of code looks like this (sorry if not very elegant, I am a newbie):

SpeckleOp=jpy.get_type("org.esa.s1tbx.sar.gpf.filtering.SpeckleFilterOp")
SpkOp=SpeckleOp()
SpkOp.setSourceProduct(spk_file)
SpkOp.setParameter('filter', "LEE_SPECKLE_FILTER")
SpkOp.setParameter('filtersizeX', 5)
SpkOp.setParameter('filtersizeY', 5)
SpkOp.setParameter('estimatedENL', True)
SpkOp.setParameter('enl', 1.0)
targetProduct= SpkOp.getTargetProduct()
ProductIO.writeProduct(targetProduct,"S1B_IW_GRDH_1SDV_20161015T165945_subset_Cal_Spk.dim", "BEAM-DIMAP")
spk_file.dispose()
targetProduct.dispose()
del SpkOp
del SpeckleOp

The problem is with the target product.
Do you have any ideas? Am I doing something wrong?

Thanks!

update: the Speckle Filtering on the same product works just fine in SNAP.

The name of the filter is wrong. It should be “Lee”

public static final String BOXCAR_SPECKLE_FILTER = “Boxcar”;
public static final String MEDIAN_SPECKLE_FILTER = “Median”;
public static final String FROST_SPECKLE_FILTER = “Frost”;
public static final String GAMMA_MAP_SPECKLE_FILTER = “Gamma Map”;
public static final String LEE_SPECKLE_FILTER = “Lee”;
public static final String LEE_REFINED_FILTER = “Refined Lee”;
public static final String LEE_SIGMA_FILTER = “Lee Sigma”;
public static final String IDAN_FILTER = “IDAN”;
public static final String MEAN_SPECKLE_FILTER = “Mean”;

2 Likes

uff…Thanks! :slight_smile: