Skip to content

t.rast.univar: Add range and correct cells values - #7529

Merged
petrasovaa merged 4 commits into
OSGeo:mainfrom
saket0187:Fix-issues-in-t.rast.univar
Jun 18, 2026
Merged

petrasovaa merged 4 commits into
OSGeo:mainfrom
saket0187:Fix-issues-in-t.rast.univar

Conversation

@saket0187

Copy link
Copy Markdown
Contributor

Fixes #7525

@github-actions github-actions Bot added temporal Related to temporal data processing Python Related code is in Python libraries module docs markdown Related to markdown, markdown files tests Related to Test Suite labels Jun 10, 2026
@ninsbl

ninsbl commented Jun 10, 2026

Copy link
Copy Markdown
Member

Nice. Thanks! The same applies also to t.rast3d.univar:
https://github.com/OSGeo/grass/actions/runs/27260952617/job/80506261338?pr=7529#step:17:101

I guess it is sufficient to update the tests there according to your changes...

ninsbl
ninsbl previously approved these changes Jun 10, 2026

@ninsbl ninsbl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me. @petrasovaa , what do you think about column names changing. Would that be considered part of the API? On the other hand, reason for the PR is a bug, so the change may be acceptable anyway?

@petrasovaa

Copy link
Copy Markdown
Contributor

This looks good to me. @petrasovaa , what do you think about column names changing. Would that be considered part of the API? On the other hand, reason for the PR is a bug, so the change may be acceptable anyway?

I am for changing. I looked at r.univar again and here is r.univar with csv output:

GRASS nc_spm_08_grass7/user1:t.rast3d.list > r.univar inundation_113.0@user1 format=csv
non_null_cells,null_cells,min,max,range,mean,mean_of_abs,stddev,variance,coeff_var,sum,sum_abs
10,2024990,0.0344314575195312,0.356651306152344,0.322219848632812,0.161949157714844,0.161949157714844,0.0899406513064383,0.00808932075742632,55.5363501579944,1.61949157714844,1.61949157714844

Notably, the order is different and there is actually not the total number of cells. So since we are changing this anyway, perhaps we should make it match completely (with the exception of the temporal-specific columns)?

@saket0187

Copy link
Copy Markdown
Contributor Author

This looks good to me. @petrasovaa , what do you think about column names changing. Would that be considered part of the API? On the other hand, reason for the PR is a bug, so the change may be acceptable anyway?

I am for changing. I looked at r.univar again and here is r.univar with csv output:

GRASS nc_spm_08_grass7/user1:t.rast3d.list > r.univar inundation_113.0@user1 format=csv
non_null_cells,null_cells,min,max,range,mean,mean_of_abs,stddev,variance,coeff_var,sum,sum_abs
10,2024990,0.0344314575195312,0.356651306152344,0.322219848632812,0.161949157714844,0.161949157714844,0.0899406513064383,0.00808932075742632,55.5363501579944,1.61949157714844,1.61949157714844

Notably, the order is different and there is actually not the total number of cells. So since we are changing this anyway, perhaps we should make it match completely (with the exception of the temporal-specific columns)?

I think there are actually some inconsistencies in r.univar as well. For example, there is an n key in the shell, JSON, and plain formats, but it's called non_null_cells in CSV. Also, the total cells count is present for shell and JSON, but it is missing entirely for CSV.

@petrasovaa

Copy link
Copy Markdown
Contributor

I think there are actually some inconsistencies in r.univar as well. For example, there is an n key in the shell, JSON, and plain formats, but it's called non_null_cells in CSV. Also, the total cells count is present for shell and JSON, but it is missing entirely for CSV.

That's true, but I don't want to change r.univar, one of the most widely used tools. I would just match the t.rast.univar with r.univar, matching the format outputs.

Comment thread temporal/t.rast.univar/t.rast.univar.md Resolved
@petrasovaa petrasovaa moved this from Todo to In Progress in GRASS Google Summer of Code 2026 Jun 18, 2026
@petrasovaa
petrasovaa enabled auto-merge (squash) June 18, 2026 02:56
@petrasovaa
petrasovaa merged commit 8f00822 into OSGeo:main Jun 18, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in GRASS Google Summer of Code 2026 Jun 18, 2026
@github-actions github-actions Bot added this to the 8.6.0 milestone Jun 18, 2026
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Jul 7, 2026
Changes order in plain format, not backwards compatible. Also fixing the total number of cells.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs libraries markdown Related to markdown, markdown files module Python Related code is in Python temporal Related to temporal data processing tests Related to Test Suite

Development

Successfully merging this pull request may close these issues.

[Bug] t.rast.univar: wrong number of cells and other inconsistencies

3 participants