[GIS] Algorithm r.reclass in QGIS gives same results with different reclass rules

grassqgisreclassify

I am trying to reclassify several rasters using the r.reclass algorithm from GRASS GIS 7, but I don't get the expected output.

My input rasters have values between 0 to 1 and NaN; and I am using 2 different reclass rules:

0.0 thru 0.24999 = 0.0
0.25 thru 1 = 1.0
* = NULL

and

0.0 thru 0.099 = 0.1
0.1 thru 0.199 = 0.2
0.2 thru 0.299 = 0.3
0.3 thru 0.399 = 0.4
0.4 thru 0.499 = 0.5
0.5 thru 0.599 = 0.6
0.6 thru 0.699 = 0.7
0.7 thru 0.799 = 0.8
0.8 thru 0.899 = 0.9
0.9 thru 1 = 1
* = NULL

After the execution of the algorithm (twice using the same input raster, only changing the reclass rule), I do obtain 2 reclassed rasters, but with only 2 categories (even though the second rule should give 10 categories), and the result is the same whatever the rule used.

During the execution of the algorithm, I do not get any error message, so I don't know how to fix the issue. If that's any help, I get the following log messages during the processing, but I do not know what to make of them.

Starting GRASS GIS... 
Executing '/home/user/.qgis2//processing/grass7_batch_job.sh' ... 

GRASS_INFO_MESSAGE(3977,1): Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default 
GRASS_INFO_END(3977,1) 

GRASS_INFO_MESSAGE(3977,2): Projection information updated 
GRASS_INFO_END(3977,2) 

GRASS_INFO_WARNING(3978,1): Over-riding projection check 
GRASS_INFO_END(3978,1) 

GRASS_INFO_MESSAGE(3978,2): Reading band 1 of 1... 
GRASS_INFO_END(3978,2) 

GRASS_INFO_MESSAGE(3978,3): r.external complete. Link to raster map created. 
GRASS_INFO_END(3978,3) 
0.500000 rounded up to 0 
0.599000 rounded up to 0 
0.600000 rounded up to 0 
0.600000 rounded up to 0 
0.699000 rounded up to 0 
0.700000 rounded up to 0 
0.700000 rounded up to 0 
0.799000 rounded up to 0 
0.800000 rounded up to 0 
0.800000 rounded up to 0 
0.899000 rounded up to 0 
0.900000 rounded up to 0 
0.900000 rounded up to 0 
0.999000 rounded up to 0 
1.000000 rounded up to 1 
1.000000 rounded up to 1 
1.099000 rounded up to 1 
1.100000 rounded up to 1 
1.100000 rounded up to 1 
1.199000 rounded up to 1 
1.200000 rounded up to 1 
1.200000 rounded up to 1 
1.299000 rounded up to 1 
1.300000 rounded up to 1 
1.300000 rounded up to 1 
1.399000 rounded up to 1 
1.400000 rounded up to 1 
1.400000 rounded up to 1 

GRASS_INFO_MESSAGE(3982,1): Checking GDAL data type and nodata value... 
GRASS_INFO_END(3982,1) 


GRASS_INFO_MESSAGE(3982,2): Using GDAL data type 
GRASS_INFO_END(3982,2) 

GRASS_INFO_MESSAGE(3982,3): Input raster map contains cells with NULL-value (no-data). The value 255 will be used to represent no-data values in the input map. You can specify a nodata value with the nodata option. 
GRASS_INFO_END(3982,3) 

GRASS_INFO_MESSAGE(3982,4): Exporting raster data to GTiff format... 
GRASS_INFO_END(3982,4) 


GRASS_INFO_MESSAGE(3982,5): r.out.gdal complete. File created. 
GRASS_INFO_END(3982,5) 
Execution of '/home/user/.qgis2//processing/grass7_batch_job.sh' finished. 
Cleaning up temporary files... 

Concerning the parameters used in r.reclass, the input and output rasters are TIF files, and the reclass rule is just a basic text file; and the others parameters are left to default. And I'm running QGIS 2.8.6-Wien.

Best Answer

The problem, as you can see from the log, is that r.reclass rounds up your raster values to either 0 or 1, depending on the value. That is because r.reclass only works with integer input values. In the algorithm help the following is stated:

r.reclass only works on an integer input raster map; if the input map is instead floating point data, you must multiply the input data by some factor to achieve whole number input data, otherwise r.reclass will round the raster values down to the next integer.

You can also try using SAGA Reclassify values.

Related Question