From 9c16c067846829f8f6cc637c1b318b4b5747a782 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 61f16930807..cec0a66f911 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))