Skip to content

Commit

Permalink
temporal: dont fail when registering maps with missing range file (#2382
Browse files Browse the repository at this point in the history
)

* dont fail with missing range file

* handle empty range separate
  • Loading branch information
ninsbl committed Sep 8, 2022
1 parent 517a57a commit bf0c12f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions python/grass/temporal/c_libraries_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,11 @@ def _read_raster_info(name, mapset):
libraster.Rast_init_fp_range(byref(range))
ret = libraster.Rast_read_fp_range(name, mapset, byref(range))
if ret < 0:
logging.error(_("Unable to read range file"))
return None
if ret == 2:
logging.warning(_("Unable to read range file"))
kvp["min"] = None
kvp["max"] = None
elif ret == 2:
logging.warning(_("Raster range file is empty"))
kvp["min"] = None
kvp["max"] = None
else:
Expand All @@ -760,9 +762,11 @@ def _read_raster_info(name, mapset):
libraster.Rast_init_range(byref(range))
ret = libraster.Rast_read_range(name, mapset, byref(range))
if ret < 0:
logging.error(_("Unable to read range file"))
return None
if ret == 2:
logging.warning(_("Unable to read range file"))
kvp["min"] = None
kvp["max"] = None
elif ret == 2:
logging.warning(_("Raster range file is empty"))
kvp["min"] = None
kvp["max"] = None
else:
Expand Down

0 comments on commit bf0c12f

Please sign in to comment.