Skip to content

Commit

Permalink
r.fillnulls: proceed if no holes present (RST method) (OSGeo#3122)
Browse files Browse the repository at this point in the history
Proceed if no holes present also for `rst` method - now all methods behave the same.

In case no holes are in the current region of the raster input map the map is copied over and no fatal error is issues (same for all methods).

Fixes OSGeo#2986
  • Loading branch information
neteler committed Nov 7, 2023
1 parent ce1df60 commit 2142e0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/r.fillnulls/r.fillnulls.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h2>NOTES</h2>
may pay attention to below notes.
<p>
If interpolation fails, temporary raster and vector maps are left in place to allow
unfilled map hole (NULL area) identification and manual repair.
unfilled map holes (NULL areas) to be identified and manually repaired.

<p>
When using the default RST method, the algorithm is based
Expand Down
11 changes: 10 additions & 1 deletion scripts/r.fillnulls/r.fillnulls.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,16 @@ def main():
os.remove(cats_file_name)

if len(cat_list) < 1:
grass.fatal(_("Input map has no holes. Check region settings."))
# no holes found in current region
grass.run_command(
"g.copy", raster="%s,%sfilled" % (input, prefix), overwrite=True
)
grass.warning(
_(
"Input map <%s> has no holes. Copying to output without modification."
)
% (input,)
)

# GTC Hole is NULL area in a raster map
grass.message(_("Processing %d map holes") % len(cat_list))
Expand Down

0 comments on commit 2142e0c

Please sign in to comment.