Skip to content

dem.py error because of wrong filename of unzipped SRTM tile (mostly over water) #750

Open
@falkamelung

Description

@falkamelung

dem.py can give an error because of wrong name of unzipped tile. For example

dem.py -a stitch --filling --filling_value 0 -b 37 39 48 51 -c -u https://e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/2000.02.11/

says:

Cannot open DEM file ./N38E050.hgt for reading.
API open (R): ./demLat_N37_N39_Lon_E048_E051.dem
API close:  ./demLat_N37_N39_Lon_E048_E051.dem
Writing geotrans to VRT for ./demLat_N37_N39_Lon_E048_E051.dem
GDAL open (R): ./demLat_N37_N39_Lon_E048_E051.dem.vrt
ERROR 1: Invalid dataset dimensions : 10800 x -1
terminate called after throwing an instance of 'std::runtime_error'
  what():  Cannot open the file ./demLat_N37_N39_Lon_E048_E051.dem.vrt in read mode.
Aborted

It does not find the file N38E050.hgt. The reason is that N38E050.SRTMGL1.hgt.zip unzips to N38E050.SRTMGL1.hgt instead of N38E050.hgt:

unzip N38E050.SRTMGL1.hgt.zip
Archive:  N38E050.SRTMGL1.hgt.zip
  inflating: N38E050.SRTMGL1.hgt

unzip N38E049.SRTMGL1.hgt.zip
Archive:  N38E049.SRTMGL1.hgt.zip
  inflating: N38E049.hgt

This gets clear from the listing of unzipped files:

 ls -l *hgt
-rw-r--r-- 1 tg851601 G-820134 25934402 Oct  8  2012 N37E048.hgt
-rw-r--r-- 1 tg851601 G-820134 25934402 Oct  8  2012 N38E048.hgt
-rw-r--r-- 1 tg851601 G-820134 25934402 Oct  8  2012 N38E049.hgt
-rw-r--r-- 1 tg851601 G-820134 25934402 Aug 10  2015 N38E050.SRTMGL1.hgt

This seems to happen primarily (possibly only) over water.

I will submit a PR that renames the unzipped tile if needed (N38E050.SRTMGL1.hgt to N38E050.hgt).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions