Error Retrieving DEM for Terrain Correction Snappy Python


#1

Hello,
So i am doing terrain correction using snappy python, when it’s on the process of retrieving dem i got error,
This how the code:

parameters = HashMap()
  parameters.put('demResamplingMethod', 'NEAREST_NEIGHBOUR')
  parameters.put('imgResamplingMethod', 'NEAREST_NEIGHBOUR')
  parameters.put('demName', 'SRTM 3Sec')
  parameters.put('pixelSpacingInMeter', 30.0)
  parameters.put('sourceBands', 'Sigma0_' + polarization)
  
  terrain = output + date + "_corrected_" + polarization
  target_2 = GPF.createProduct("Terrain-Correction", parameters, target_0)
  ProductIO.writeProduct(target_2, terrain, 'GeoTIFF-BigTIFF')

and here the error line:

INFO: org.esa.snap.core.dataop.dem.ElevationFile: http retrieving http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_58_14.zip

WARNING: org.esa.snap.core.dataop.dem.ElevationFile: http error:http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_58_14.zip on http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_58_14.zip

WARNING: org.esa.s1tbx.sar.gpf.geometric.RangeDopplerGeocodingOp: Terrain-Correction$1679C8206DC error: no valid output was produced. Please verify the DEM

I also tried to use dem manually but still got error, so i replace parameter code

dempath = "dem.tif"
parameters.put('demName', dempath)

error line:
The DEM 'dem.tif' is not supported.

Thank You


#2

[Solve external DEM]
For the last part i come to solve the problem as i see further into the documentation on ‘gpt -h’ as you can use parameter:
parameters.put('externalDEMFile', 'dempath')

The question I have now are:
When running the script, it seems it still tries to auto download DEM which still gives error as a pointed out. I assume when it failed to download DEM, the external DEM will be used.
So, can I skip the process of auto download DEM and just use the external DEM instead?

Thank You


#3

The download service of SRTM data from CGIAR CSI has been updated in November.
The the download location of srtm_58_14 is
http://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_58_14.zip

It might work if you change the URL in the snap.auxdata.properties file. It is located in the etc folder of the SNAP installation directory.
DEM.srtm3GeoTiffDEM_HTTP = http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/
to
DEM.srtm3GeoTiffDEM_HTTP = http://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/