grass icon indicating copy to clipboard operation
grass copied to clipboard

[Bug] r.reclass: no output + silent with large number of classes in rule

Open fxi opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug

When trying to reclass a complex land cover map, the module fails silently. No output. No errors. So, my script fails later, as there is no error to catch.

To Reproduce

  1. Extract demo.tiff + reclass.txt from sample.zip (25KB)
  2. Import demo.tiff raster ( 414KB ) in a xy location, set region ext based in demo layer
  3. r.reclass input=demo output=reclassed rules=reclass.txt

Expected behavior

a ) Correctly reclass b ) In case of failure, throw an error

System description

  • Operating System: Linux 5.10.104-linuxkit, macOS 12.5.1
  • Platform : aarch64
  • GRASS GIS version : 8.0.2 (custom compilation for ARM) , 7.6.1 (x86 release)

Observation

Seems to fail when the reclass rule has more than 1023 characters

Thanks !

fxi avatar Sep 20 '22 13:09 fxi

I compiled a version of r.reclass using 102400 in https://github.com/OSGeo/grass/blob/main/raster/r.reclass/main.c#L32 and it seems to be solved. I don't measure the impact of this change. parse.c and input.c have been altered too.

fxi avatar Sep 20 '22 15:09 fxi