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.univar: print correct cells value for zones in shell script style #2959

Merged
merged 2 commits into from
May 17, 2023

Conversation

ninsbl
Copy link
Member

@ninsbl ninsbl commented May 15, 2023

Currently, the number of cells in the first zone is propagated to subsequent zones in r.univar (see: #2958)
This PR corrects the value printed and adjusts the tests accordingly.

@ninsbl ninsbl added bug Something isn't working backport_needed C Related code is in C labels May 15, 2023
@ninsbl ninsbl added this to the 8.3.0 milestone May 15, 2023
@ninsbl ninsbl requested review from wenzeslaus and metzm May 15, 2023 20:55
Copy link
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

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

Good catch, thanks. All the other lines are using it as an array and it is created as:

stats = (univar_stat *)G_calloc(n_zones, sizeof(univar_stat));

so -> does not make sense in this context.

@wenzeslaus wenzeslaus removed the request for review from metzm May 17, 2023 14:37
@wenzeslaus wenzeslaus linked an issue May 17, 2023 that may be closed by this pull request
@wenzeslaus wenzeslaus merged commit aaa5f6d into OSGeo:main May 17, 2023
@landam landam modified the milestones: 8.3.0, 8.4.0 Jun 6, 2023
@landam landam modified the milestones: 8.4.0, 8.3.0 Jun 6, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
…SGeo#2959)

When r.univar is called with zones and the g-flag for shell script output, the "cells" attribute gets always the number of cells in the first zone encountered, which does not correspond to the actual number of cells in the zone (or in the region in total). This corrects the value printed and adjusts the tests accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C Related code is in C
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] r.univar: Wrong cell number for other zones than the first
3 participants