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

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

Closed
ninsbl opened this issue May 12, 2023 · 0 comments · Fixed by #2959
Closed

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

ninsbl opened this issue May 12, 2023 · 0 comments · Fixed by #2959
Assignees
Labels
bug Something isn't working C Related code is in C
Milestone

Comments

@ninsbl
Copy link
Member

ninsbl commented May 12, 2023

Describe the bug
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).

The issue is likely this line:

fprintf(stdout, "cells=%lu\n", stats->size);

which should read:

fprintf(stdout, "cells=%lu\n", stats[z].size);

To Reproduce
Steps to reproduce the behavior:

g.region -p raster=landclass96
r.univar map=elevation zone=landclass96 -g

and compare the values in "cells"

Expected behavior
The value of cells should represent the number of zones also in shell script style.

System description (please complete the following information):

  • Operating System: Fedora Linux 37
  • GRASS GIS version 8.3.dev
@ninsbl ninsbl added bug Something isn't working backport_needed labels May 12, 2023
@ninsbl ninsbl added this to the 8.3.0 milestone May 12, 2023
@ninsbl ninsbl self-assigned this May 12, 2023
@ninsbl ninsbl added the C Related code is in C label May 12, 2023
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 a pull request may close this issue.

2 participants