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

r.watershed: Keep 0 accumulation with -a as 0 as opposed to null #2169

Merged
merged 2 commits into from Feb 16, 2022

Conversation

HuidaeCho
Copy link
Member

@HuidaeCho HuidaeCho commented Feb 4, 2022

This PR addresses #2003 by saving 0 accumulated cells as 0, not as null, for the -a flag. It does not change the default behavior without -a.

Its side effect is that cells outside non-null input are also saved as 0 (was null before this PR), which is in fact more consistent with the default output without the -a flag. I think with/without -a, null input cells should produce null output cells (TODO).

@HuidaeCho HuidaeCho added bug Something isn't working raster Related to raster data processing labels Feb 4, 2022
Copy link
Contributor

@metzm metzm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@ar-siddiqui
Copy link

@HuidaeCho thanks for taking care of the original issue. Yes, I also noticed this as well that without -a flag original null cells are being converted to 0 value. This is lesser of a problem because the user can use a raster calculator this way (input raster * 0) + grass output to get the null values back.

Having said that can r.watershed do that internally as a last step to fix nulls being converted to 0? Perhaps this should be discussed in a separate issue.

@HuidaeCho HuidaeCho merged commit 792b890 into OSGeo:main Feb 16, 2022
@HuidaeCho HuidaeCho deleted the r_watershed_null_accum branch February 18, 2022 19:45
@HuidaeCho
Copy link
Member Author

@HuidaeCho thanks for taking care of the original issue. Yes, I also noticed this as well that without -a flag original null cells are being converted to 0 value. This is lesser of a problem because the user can use a raster calculator this way (input raster * 0) + grass output to get the null values back.

Having said that can r.watershed do that internally as a last step to fix nulls being converted to 0? Perhaps this should be discussed in a separate issue.

Check #2221.

@wenzeslaus wenzeslaus added this to the 8.2.0 milestone Apr 11, 2022
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
…eo#2169)

* r.watershed: Keep 0 accumulation with -a as 0 as opposed to null

* apply the same change to seg
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
…eo#2169)

* r.watershed: Keep 0 accumulation with -a as 0 as opposed to null

* apply the same change to seg
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
…eo#2169)

* r.watershed: Keep 0 accumulation with -a as 0 as opposed to null

* apply the same change to seg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working raster Related to raster data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants