Skip to content

Commit

Permalink
Add error if output has no data
Browse files Browse the repository at this point in the history
  • Loading branch information
bordoray committed Aug 20, 2024
1 parent 45959b8 commit 6b3de0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/convert_fgd_dem/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ def run(self):
self.dem.all_content_list.append(self.dem.get_xml_content(xml_path))
self.addProgress.emit(1)

# Stop process if output is a whole no data dem
is_nodata_dem = True
for content in self.dem.all_content_list:
items = content["elevation"]["items"]
if any(item != "-9999." for item in items):
is_nodata_dem = False
break

if is_nodata_dem:
self.processFailed.emit("Output DEM has no elevation data.")
self.process_interrupted = True

# Don't produce geotiff if process aborted by user
if self.process_interrupted:
return
Expand Down

0 comments on commit 6b3de0a

Please sign in to comment.