Skip to content

Commit 5f1282c

Browse files
scottstanieclaude
andcommitted
Fix default output name for NASA source (fixes #14)
When using --data-source NASA without explicit -o, the CLI defaulted to elevation.tif (GTiff format). But the NASA code path writes raw binary + .rsc sidecar, so GDAL couldn't open the file during EGM-to-WGS84 conversion (it expected a real GeoTIFF). Fix: force output_format to ENVI for NASA sources in the CLI, which makes the default output name elevation.dem. Also assert ENVI format in dem.main() as a safety net. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c662034 commit 5f1282c

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

sardem/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ def cli():
202202
else:
203203
bbox = None
204204

205+
# NASA sources write raw binary + .rsc sidecar, not GeoTIFF
206+
if args.data_source in ("NASA", "NASA_WATER"):
207+
args.output_format = "ENVI"
208+
205209
if not args.output:
206210
if args.data_source == "NASA_WATER":
207211
output = "watermask.flg"

sardem/dem.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,10 @@ def main(
408408
return
409409

410410
# If using SRTM, download tiles manually and stitch
411-
if output_format != "ENVI":
412-
logger.warning(
413-
"NASA data source only supports ENVI format. Ignoring output_format=%s",
414-
output_format,
415-
)
411+
assert output_format == "ENVI", (
412+
f"NASA data source only supports ENVI format, got {output_format!r}."
413+
" Use COP or 3DEP for GTiff output."
414+
)
416415

417416
# Check for dateline crossing
418417
bboxes = utils.check_dateline(bbox)

0 commit comments

Comments
 (0)