TerraSARXCalibrator: java.lang.NullPointerException when calibrating a subset of a TerraSAR-X image

My question is similar to the one asked here, but the solution suggested there didn’t solve it.

I did a subset of a TerraSAR-X image, and then I tried to calibrate the obtained subset with gpt (and from Snap GUI, but I’m getting the following error:

org.esa.snap.core.gpf.OperatorException: TerraSARXCalibrator: java.lang.NullPointerException.

The calibration seems to work with the Sentinel-1 calibrator though.
I’ve already made sure that the calibration metadata is present in the input product inside Original_Product_Metadata, so the problem is possibly caused by something else.

It seems that this error appears only when the file given as input is in the GeoTIFF format, while the calibration works well when it’s in the BEAM-DIMAP format.

Another java.lang.NullPointerException error appeared when I try to open the BEAM-DIMAP file to calibrate with Snappy from a Django web app. I’ve reported this issue on Github, but maybe this forum is more appropriate to get help, since this doesn’t look like a bug.

The piece of code responsible for this error is literally the one below (the instruction throwing the error is the ProductIO.readProduct() below):

def test(request):
    path_sar = '<path>/file.dim'
    sar_pre_product = ProductIO.readProduct(path_sar)

Anyway, I’ve enabled debug: True in Snappy and here is the output I got:

JMethod_InvokeMethod: calling static Java method org.esa.snap.core.dataio.ProductIO#readProduct
Exception in thread "Thread-1" java.lang.NullPointerException
        at com.bc.ceres.binding.converters.ClassConverter.loadClass(ClassConverter.java:100)
        at com.bc.ceres.binding.converters.ClassConverter.parse(ClassConverter.java:83)
        at org.esa.snap.core.util.converters.JavaTypeConverter.parse(JavaTypeConverter.java:40)
        at org.esa.snap.core.dataio.geometry.VectorDataNodeReader.getAttributeType(VectorDataNodeReader.java:403)
        at org.esa.snap.core.dataio.geometry.VectorDataNodeReader.createFeatureType(VectorDataNodeReader.java:379)
        at org.esa.snap.core.dataio.geometry.VectorDataNodeReader.readFeatureType(VectorDataNodeReader.java:347)
        at org.esa.snap.core.dataio.geometry.VectorDataNodeReader.readFeatures(VectorDataNodeReader.java:227)
        at org.esa.snap.core.dataio.geometry.VectorDataNodeReader.read(VectorDataNodeReader.java:150)
        at org.esa.snap.core.dataio.geometry.VectorDataNodeReader.read(VectorDataNodeReader.java:117)
        at org.esa.snap.core.dataio.dimap.DimapProductReader.addVectorDataToProduct(DimapProductReader.java:432)
        at org.esa.snap.core.dataio.dimap.DimapProductReader.readVectorData(DimapProductReader.java:411)
        at org.esa.snap.core.dataio.dimap.DimapProductReader.processProduct(DimapProductReader.java:147)
        at org.esa.snap.core.dataio.dimap.DimapProductReader.readProductNodesImpl(DimapProductReader.java:117)
        at org.esa.snap.core.dataio.AbstractProductReader.readProductNodes(AbstractProductReader.java:169)
        at org.esa.snap.core.dataio.ProductIO.readProductImpl(ProductIO.java:216)
        at org.esa.snap.core.dataio.ProductIO.readProduct(ProductIO.java:186)

As you have marked the issue as solved - can you tell us the solution to your problem?

No I though it was fixed, but I’m still stuck in the same problem and I can’t really figure out why the above small piece of code works from the command-line and not from the internet browser (from the web application).

I see. I removed the “solved” and hope someone can give you an answer.

To summarize the issue I’m facing (it occurs with both Django and Flask on the Internet browser):

  • If the subset is GeoTIFF it cannot be calibrated but can be read with Snappy (makes sense).
  • If the subset is a BEAM-DIMAP it cannot even be read with Snappy (the java stack trace is above), but I assume it should calibrate without a problem.

The ugly workaround I’ve found is to put that piece of code inside a python script (let’s call it: test.py) and call it from the Django view using subprocess.call(['python', 'test.py']).

1 Like