-
-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r.recode results in integer when floating numbers are expected [Bug] #3720
Comments
You need to add the
Try:
|
Thanks. I know you can use the -d flag (and I wrote that in the bug report), but the point I was trying to make is that based on the manual, I would not necessarily expect r.recode to convert the floating map to an integer map, as I used decimal numbers for the new minimum and maximum value. I think that either the behavior should be changed, or the behavior (when does the function change the data type) should be explained more explicitly. |
I see, I missed that.
I agree with this. I also find the manual confusing on this regard. The manual first states that r.recode is for recoding categorical maps, which it seems to be made for, but then gives an example of rescaling, for which r.mapcalc is more convenient. |
This seems like a bug to me.
|
It seems that the problem lies in parsing or managing the input, as numbers ending in zero are not interpreted as float. Example: Edit: deleted reference to rules, as I could not trace the exact source of the problem. |
It seems to me that this part in grass/raster/r.recode/read_rules.c Lines 136 to 146 in f4d8c62
Perhaps line 142 could be replaced with a call to a function to tell if A simple work around could be to default output to integer, unless it is forced to double using the |
Describe the bug
I have a map with data type Float, with values between 0 and 18.7. I use
r.recode
to rescale the layer to values between 0 and 1 using the steps below. I expect the output to be a float raster. But it is converted to an integer map instead.To reproduce
The resulting output layer is an integer raster.
Expected behavior
I would expect the output layer to be a float raster. Using the -d flag will force the output layer to be of type DCELL.
System description
The text was updated successfully, but these errors were encountered: