From 43b34097fcb9ed0d4c61429363ff08df6707ed78 Mon Sep 17 00:00:00 2001 From: Markus Neteler Date: Mon, 14 Aug 2023 16:51:14 +0200 Subject: [PATCH] r.fillnulls: proceed if no holes present (RST method) (#3122) 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 #2986 --- scripts/r.fillnulls/r.fillnulls.html | 2 +- scripts/r.fillnulls/r.fillnulls.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/r.fillnulls/r.fillnulls.html b/scripts/r.fillnulls/r.fillnulls.html index 240d3259394..f2d7321d6b2 100644 --- a/scripts/r.fillnulls/r.fillnulls.html +++ b/scripts/r.fillnulls/r.fillnulls.html @@ -27,7 +27,7 @@

NOTES

may pay attention to below notes.

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.

When using the default RST method, the algorithm is based diff --git a/scripts/r.fillnulls/r.fillnulls.py b/scripts/r.fillnulls/r.fillnulls.py index 7aff6204ccc..219f9dafa07 100755 --- a/scripts/r.fillnulls/r.fillnulls.py +++ b/scripts/r.fillnulls/r.fillnulls.py @@ -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))