0

I use GRASS 7.8.7 (2022). For a DEM raster r.fillnulls input=file1 output=file2 I get:

Registering primitives...
Using RST interpolation...
Locating and isolating NULL areas...
100%
Growing NULL areas
Assigning IDs to NULL areas
100%
Processing 1 map holes
Filling hole 1 of 1
ERROR: Invalid input <n=n+0>
ERROR: abandoned. Removing temporary maps, restoring user mask if needed:

I tried different tension values. Result is the same.

Bilinear method gives other error:

Using bilinear bspline interpolation
Patching fill data into NULL areas...
ERROR: Raster map <r_fillnulls_318_filled> not found
Traceback (most recent call last):
File "/usr/local/grass78/scripts/r.fillnulls", line 540, in <module>
main()
File "/usr/local/grass78/scripts/r.fillnulls", line 515, in main
output=output, overwrite=True)
File "/usr/local/grass78/etc/python/grass/script/core.py", line 441, in run_command
return handle_errors(returncode, returncode, args, kwargs)
File "/usr/local/grass78/etc/python/grass/script/core.py", line 343, in handle_errors
returncode=returncode)
grass.exceptions.CalledModuleError: Module run None r.patch --o       input=rawdem,r_fillnulls_318_filled output=dem ended with error
Process ended with non-zero return code 1. See errors in the (error) output.
WARNING: No data base element files found

No idea about could it be

UPD: Result of g.region -p

projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      1N
south:      0
west:       0
east:       1E
nsres:      1
ewres:      1
rows:       1
cols:       1
cells:      1

Looks strange, but rawdem layer that is the source for the operation looks good.

UPD2:

I added g.region raster=rawdem after it is imported to grass. Now I get another error ERROR: Input map has no holes. Check region settings. Now g.region -p is

projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      65N
south:      50N
west:       115E
east:       125E
nsres:      0:00:03
ewres:      0:00:03
rows:       18000
cols:       12000
cells:      216000000

The resulting raster still is not generated. Seems to be a bug in r.fillnulls code: if there is no holes - the result isn't generated. Maybe I could previously check if there are some NaN values?

UPD3: Now another case. Previously we detected a bug in r.filnulls algorhythm, that I sent to github. Here is an n+0 error with file that HAS zero values:

> r.univar -ge rawdem
n=684000000
null_cells=72000000
  
>  r.fillnulls input=rawdem output=dem --verbose
Growing NULL areas
Assigning IDs to NULL areas
100%
Processing 1 map holes
Filling hole 1 of 1
ERROR: Invalid input <n=n+0>
ERROR: abandoned. Removing temporary maps, restoring user mask if needed:

The error is same, there is 72000000 nulls in the layer. But here the cause is that the rawdem raster (which is an external of vrt) does not have all tiles of DEM. So, r.univar thinks, that it has nulls, but in reality these nulls are due to holes in data. Of course it is worth to check previously, if all tiles are present for DEM, but it is not too memory savy to provide always rectangular regions only in order to fill null values. So, developers could consider to add an algorhythm, that understands where there is a hole and where there is a null edge of the map.

And with bilinear the same case gives:

 > r.fillnulls input=rawdem output=dem method=bilinear --verbose
 Using bilinear bspline interpolation
 Patching fill data into NULL areas...
 ERROR: Raster map <r_fillnulls_667_filled> not found
 Traceback (most recent call last):
 File "/usr/local/grass78/scripts/r.fillnulls", line 540, in <module>
main()
 File "/usr/local/grass78/scripts/r.fillnulls", line 515, in main
  output=output, overwrite=True)
 File "/usr/local/grass78/etc/python/grass/script/core.py", line 441, in 
 run_command
return handle_errors(returncode, returncode, args, kwargs)
 File "/usr/local/grass78/etc/python/grass/script/core.py", line 343, in 
 handle_errors
 returncode=returncode)
 grass.exceptions.CalledModuleError: Module run None r.patch --o 
 input=rawdem,r_fillnulls_667_filled output=dem ended with error
 Process ended with non-zero return code 1. See errors in the (error) 
 output.
 WARNING: No data base element files found
3
  • Please edit and add the output of g.region -p.
    – markusN
    Commented May 25, 2023 at 22:38
  • Strange, I updated. My DEM looks good. But g.region shows strange values. Commented May 26, 2023 at 7:30
  • So I should use eval g.region -g in my script? But where? ogr2ogr -f CSV -spat $EXTENT list.csv an_index.shp writes tiles for extent gdalbuildvrt -input_file_list list.csv dem.vrt builds a dem file r.external input=$DIR_PATH/dem.vrt output=rawdem imports it Where should I set the region? Commented May 26, 2023 at 7:40

1 Answer 1

0

Your initial g.region values shows those of a freshly created location: 1 pixel only.

Then, using g.region raster=myrastermap sets it to the boundary box and the spatial resolution of the raster map (so you did then, good).

Importantly, raster computation adheres to the currently set https://grasswiki.osgeo.org/wiki/Computational_region.

Now, if r.fillnulls reports "Input map has no holes" then the raster map doesn't have any hole in the current computational region. Maybe visual inspection can help here (the current region is shown as a red box on the map, try to zoom out if you don't see it).

Edit:

I have made a test with a sample map which does not contain a hole (North Carolina sample dataset):

GRASS 7.8.8dev (nc_spm_08_grass7): > g.region raster=elevation

# A) using bilinear method
GRASS 7.8.8dev (nc_spm_08_grass7): > r.fillnulls input=elevation output=elev_fill_test method=bilinear
Using bilinear bspline interpolation
Copy raster <elevation@PERMANENT> to current mapset as
<r_fillnulls_1844093_filled>
WARNING: Input map <elevation> has no holes. Copying to output without
         modification.
Patching fill data into NULL areas...
 100%
Filled raster map is: elev_fill_test
Done.

# B) using default RST method
GRASS 7.8.8dev (nc_spm_08_grass7):~/software/grass78_git > r.fillnulls input=elevation output=elev_fill_test2
Using RST interpolation...
Locating and isolating NULL areas...
 100%
Growing NULL areas
Assigning IDs to NULL areas
 100%
ERROR: Input map has no holes. Check region settings.

I agree that the latter is a bit confusing: it should also just copy the full map as in the bilinear method case.

Can you please open an issue for that at https://github.com/OSGeo/grass/issues? I can already confirm this behavior for GRASS GIS 8.2.

EDIT: Issue confirmed and fixed at https://github.com/OSGeo/grass/pull/3122. This will be part of GRASS GIS 8.3.1+.

7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.