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

t.rast.univar: allow r-flag combined with zones option #4577

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

ninsbl
Copy link
Member

@ninsbl ninsbl commented Oct 23, 2024

Fix #4576

The library function actually used already a region environment. So it did not have to be added. But the region env was actualy applied redundant to the r-flag for STRDS...
So, now, the region env is only used if r-flag and zones are combined or for STR3DS. If only the r-flag is used, it is propagated to r.univar (for STRDS).

@ninsbl ninsbl added enhancement New feature or request temporal Related to temporal data processing Python Related code is in Python labels Oct 23, 2024
@ninsbl ninsbl added this to the 8.5.0 milestone Oct 23, 2024
@github-actions github-actions bot added libraries module tests Related to Test Suite labels Oct 23, 2024
@echoix
Copy link
Member

echoix commented Oct 23, 2024

I don't see a problem with the code changed, but I don't think I understand well the issue. What was the exclusivity between the options protecting before?

I think it boils down to the fact that I don't know yet the details of the implementation of an STR3DS vs just a temporal raster STRDS.

@ninsbl
Copy link
Member Author

ninsbl commented Oct 23, 2024

r.univar does not allow to use the r-flag and the zones option, because the region would change while the zones map is open. That limitation was handed down to the temporal application of the module. However, the region can be changed to the input map(s) using a region env for the call to r.univar. That would have the same effect and circumvent the problem in r.univar.

r3.univar does not have an r-flag (see: https://grass.osgeo.org/grass-stable/manuals/r3.univar.html), so space time 3D raster datasets need to use the region env to that effect anyway...

@ninsbl
Copy link
Member Author

ninsbl commented Oct 24, 2024

@neteler or @veroandreo do you have any thoughts on this maybe?

@echoix
Copy link
Member

echoix commented Oct 24, 2024

r.univar does not allow to use the r-flag and the zones option, because the region would change while the zones map is open. That limitation was handed down to the temporal application of the module. However, the region can be changed to the input map(s) using a region env for the call to r.univar. That would have the same effect and circumvent the problem in r.univar.

r3.univar does not have an r-flag (see: https://grass.osgeo.org/grass-stable/manuals/r3.univar.html), so space time 3D raster datasets need to use the region env to that effect anyway...

Thanks, I better understand why the change works now. The biggest missing piece for me was that zones is like map (that is to be opened), and they can have different regions

@ninsbl ninsbl requested a review from neteler October 25, 2024 10:33
Copy link
Member

@echoix echoix left a comment

Choose a reason for hiding this comment

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

I've attentively reviewed (in an IDE this time) in regard to this comment: #4577 (comment).
So if that comment makes sense, then after addressing the docstring review comment, this PR would be good to go.

Sorry for the delay, I didn't touch a computer for the whole week

python/grass/temporal/univar_statistics.py Show resolved Hide resolved
Copy link
Member

@echoix echoix left a comment

Choose a reason for hiding this comment

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

There wasn't any other objections and the docstring updated

@echoix echoix enabled auto-merge (squash) November 7, 2024 22:26
@echoix echoix merged commit b929809 into OSGeo:main Nov 8, 2024
26 checks passed
@ninsbl
Copy link
Member Author

ninsbl commented Nov 8, 2024

Thanks!

a0x8o pushed a commit to a0x8o/grass that referenced this pull request Nov 11, 2024
* allow r-flag and zones

* add test for r-flag and zones

* use region env only with zones

* use region env for r3.univar

* Update docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libraries module Python Related code is in Python temporal Related to temporal data processing tests Related to Test Suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] r.univar/t.rast.univar: allow r-flag also with zones input
2 participants