Issues applying (external) DEMs in SNAP

Sorry to bump this old thread but it’s Jun '18 and I’m having the same problems (mainly the java.lang.NullPointerException)

I’m just curious if anyone has ever gotten an external DEM to work??? If so, I’ll continue trying…

I’m on SNAP 6.0 with all the latest updates on a 64-bit Windows 10 machine. I was having a hard time getting an external LIDAR-based DEM to load but then I tried a SRTM1 file that I downloaded and even that failed.

At which step do you want to ingetrate it?

I noticed that you have to be careful about the DEM nodata value. If this is not entered correctly, SNAP can have problems to process the data. One good way is to load the TIF file of the DEM into SNAP and use the pixel info tab to retrieve the nodata value (if there is one).

I assume you already projected your data to WGS84?

2 Likes

I’ve been trying at the Radiometric Terrain Flattening stage but I’ll need it later for Range-Doppler Terrain Correction.

I’ve reprojected to WGS84 and also confirmed the nodata values (both operations in SNAP to be safe) so I don’t think that is it.

But your question got me thinking and I wonder if there is an issue with some subsetting I have been doing. In SNAP, when I subset a full S1A scene and also load in the reprojected DEM, I can see the following in the WorldView—basically the subsetted scene (the rotated rectangle) is completely within the DEM (the approx. square).

However when I export both and check in QGIS, the subsetted scene’s geographic location and shape are not correct. It’s flipped and warped.

At this point, I’ve only applied the orbit file and done thermal correction and calibration so I get why the geometry is off although I am surprised I could export it without a warning. Do you think it is possible that when trying to use an External DEM, somehow the tool is thinking my DEM and scene don’t overlap and hence throwing the error?

By the way, I’m subsetting because I don’t have a DEM that covers the whole scene area yet.

unleass you perform Range Doppler Terrain Correction QGIS cannot display your data properly because it lacks proper geocoding (at least QGIS cannot read it). As long as they match inside SNAP (in the WorldView window) this shouldn’t be a problem.

Subsetting your data is fine as long as the DEM fully covers the SAR data, as it is the case. Just to go sure: You converted the DEM to a tif file?

Thanks for the prompt replies!

One more thought…do the values of the DEM have to be integer (in m)?

Can you please load it in SNAP again and click the Geo-Coding button grafik and post the result in here?

Maybe converting the DEM to integer is also worth a try, yes!

Thanks again for the advice!

I tried everything fresh but sadly for all permutations of my external dem (original in UTM, converted to wgs84, converted to decimal, all with several options for NoData including NaN, 0.0 and -2147483678) I always get the following error:

java.lang.NullPointerException
	at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.generateSimulatedImage(TerrainFlatteningOp.java:528)
Caused: org.esa.snap.core.gpf.OperatorException
	at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:432)
	at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.generateSimulatedImage(TerrainFlatteningOp.java:764)
	at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.computeTileStack(TerrainFlatteningOp.java:483)
Caused: org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
	at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:432)
	at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.computeTileStack(TerrainFlatteningOp.java:497)
	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)
Caused: org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
	at org.esa.snap.core.gpf.internal.OperatorExecutor$GPFImagingListener.errorOccurred(OperatorExecutor.java:376)
	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)
[catch] at com.sun.media.jai.util.WorkerThread.run(SunTileScheduler.java:468)

I even get the same error when trying SRTM1 as downloaded from NASA’s EarthExplorer so I don’t think it is actually my DEM.

It does work when I use auto-download so I don’t think there is an issue with my SAR file.

(the only operation I did outside SNAP (in ArgGIS) was the conversion to int from float because I couldn’t find that in Band Math…round() just returns a rounded float.)

And I am certain that my SAR file fits well within the extent of my DEM.

Oh, and here’s the Geo-Coding output for what it’s worth.

have you tried the new SNAP 7 beta version? It has some improvements regarding terrain flattening.

I’ll try that next, but I can’t help but wonder if there is something wrong with my path to the DEM?

It’s interesting but it fails with the same NullPointerException even when I point the external DEM at the path of the srtm tile that SNAP downloaded automatically! And for good measure, I tested it on a copy of that downloaded file in my normal working directory (with no spaces)…no luck.

C:\Users\hal9000\.snap\auxdata\dem\SRTM 1Sec HGT\N19W073.SRTMGL1.hgt.zip

Oh, and to note, for SRTM, nodata is -32768.

On to 7.0!

I had similar struggles with external DEMs so I don’t think there is something specifically wrong at your side.

1 Like

Unfortunately I have the same error in 7.0 on Windows but…it works in 6.0 on my Mac!!!

After all that work, though, I really can’t see much difference in the final output. I’ll have to test this later and see.

Thanks again for your help!

that is suspicious, thank you for reporting.

Hi all,

I’m having a similar problem described by others. I’m trying to use some TanDEM-X DEM tiles (trying with both 0.4 arcsec / 12 m and 1 arcsec / 30 m). The DEMs are in WGS84 and I’ve tried converting to integer format, merging the tiles, separating the tiles, among a number of other iterations (all with gdal_translate). No matter what I do, the processing fails. When I use an auto-download option (SRTM HGT files), the processing goes fine. I’ve tried on SNAP v.6 and just now on beta 7, no luck. All the processing is via the gpt tool on a linux machine. I would really like to apply a higher quality terrain correction with the nice TanDEM-X data. Here’s a look at my errors:

INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
SEVERE: org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller: The environment variable LD_LIBRARY_PATH is not set. It must contain the current folder '.'.
Executing processing graph
INFO: org.hsqldb.persist.Logger: dataFileCache open start
..java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
90% done.
org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
        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.cobbleFloat(PlanarImage.java:3254)
        at javax.media.jai.PlanarImage.getData(PlanarImage.java:2181)
        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.Operator.getSourceTile(Operator.java:461)
        at org.esa.s1tbx.sar.gpf.geometric.RangeDopplerGeocodingOp.getPixelValue(RangeDopplerGeocodingOp.java:1227)
        at org.esa.s1tbx.sar.gpf.geometric.RangeDopplerGeocodingOp.computeTileStack(RangeDopplerGeocodingOp.java:1037)
        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)
        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: java.lang.NullPointerException
        at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:415)
        at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.computeTileStack(TerrainFlatteningOp.java:498)
        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)
        ... 23 more
Caused by: org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
        at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:415)
        at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.generateSimulatedImage(TerrainFlatteningOp.java:663)
        at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.computeTileStack(TerrainFlatteningOp.java:484)
        ... 26 more
Caused by: java.lang.NullPointerException
        at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.generateSimulatedImage(TerrainFlatteningOp.java:528)
        ... 27 more

Error: java.lang.NullPointerException
Problem reading DEM: Couldn't seek!
java.lang.NullPointerException
java.lang.NullPointerException
Problem reading DEM: Couldn't seek!
java.lang.NullPointerException
java.lang.NullPointerException

Have you updated your Mac 6.0 SNAP? I had a working setup for daily and 3 times monthly mosaic for Finland that broke down on 23.5. then I updated the SNAP 6.0 setup. Please check, which exact version of the s1 toolbox is installed. I’m running currently the processing without Terrain-Flattening as for Finland there is no SRTM autodownload available north of 60° and the other options have in many places of Finland artifacts.

Hello Step forum everyone,
I am a beginner who is just learning to use SNAP, and I would like to ask for suggestions on how to import external DEMs in SNAP, such as Doppler terrain correction as an example.