Skip to content
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

[Processing] Rescale Raster gives bad results. #41084

Closed
roya0045 opened this issue Jan 19, 2021 · 7 comments
Closed

[Processing] Rescale Raster gives bad results. #41084

roya0045 opened this issue Jan 19, 2021 · 7 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@roya0045
Copy link
Contributor

The Rescale Raster tool gives nonsensical results in some instances.

I have a raster (float64) whose value are ranging from -1 to 255.
image

As those should represent a direction (originally from r.terraflow ) I want to turn them into quadrants.

When I process the data to rescale the values between 0 and 7 or 1 and 8.

In the resulting layer I seem to get an overflow and values are either between e-20 and 0 while some others are up in 7e+37
image

Tested on 3.16.1 and 3.16.3 ( the alg is inchanged so any change would be surprisig).

Works fine on raster with a positive range.

@roya0045 roya0045 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 19, 2021
@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Jan 19, 2021
@gioman
Copy link
Contributor

gioman commented Jan 19, 2021

I have a raster (float64) whose value are ranging from -1 to 255.

@roya0045 can you attach it here?

@roya0045
Copy link
Contributor Author

This should be sufficient. Data placement has been altered.
0-255_rast.zip
With the default values its somewhat fine, but for a small range, it breaks. The result should look checkered if you limit the values between -1 and the intended max value.

@roya0045
Copy link
Contributor Author

With the normalisation formula in the raster calculator the output is fine.

@roya0045
Copy link
Contributor Author

-1 as the minimum value seems to be the cause. I tried but offsetting the values by 1, it works fine, and with an offset or -3, making the minimum -4, its also fine.

@roya0045
Copy link
Contributor Author

@gioman Did you had the chance to test and is the behavior the same on Linux?

@gioman
Copy link
Contributor

gioman commented Jan 20, 2021

@gioman Did you had the chance to test and is the behavior the same on Linux?

@roya0045 yes, is the same (master).

@roya0045
Copy link
Contributor Author

Thank Gio!

@alexbruy simple ping to inform you of this issue.

@rouault rouault self-assigned this Jan 23, 2021
rouault added a commit to rouault/QGIS that referenced this issue Jan 25, 2021
github-actions bot pushed a commit that referenced this issue Jan 27, 2021
nyalldawson pushed a commit that referenced this issue Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

3 participants