Skip to content

r.univar: Fix JSON structure #5688

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

NishantBansal2003
Copy link
Contributor

Fixes: #5652

  • JSON output without zones option:
{
            "n": 16200,
            "null_cells": 0,
            "cells": 16200,
            "min": 102,
            "max": 380,
            "range": 278,
            "mean": 241,
            "mean_of_abs": 241,
            "stddev": 62.04702517714555,
            "variance": 3849.8333333333335,
            "coeff_var": 25.745653600475332,
            "sum": 3904200,
            "first_quartile": 191,
            "median": 241,
            "third_quartile": 291,
            "percentiles": [{"percentile": 90, "value": 324}],
}
  • JSON output with zones option:
[
            {
                "zone": 1,
                "zone_label": "",
                "n": 3420,
                "null_cells": 0,
                "cells": 3420,
                "min": 102,
                "max": 309,
                "range": 207,
                "mean": 205.5,
                "mean_of_abs": 205.5,
                "stddev": 56.611983419296187,
                "variance": 3204.9166666666665,
                "coeff_var": 27.548410423015174,
                "sum": 702810,
                "first_quartile": 155,
                "median": 205.5,
                "percentiles": [{"percentile": 90, "value": 282}],
                "third_quartile": 255,
            },
            {
                "zone": 2,
                "zone_label": "",
                "n": 12780,
                "null_cells": 0,
                "cells": 12780,
                "min": 121,
                "max": 380,
                "range": 259,
                "mean": 250.5,
                "mean_of_abs": 250.5,
                "stddev": 59.957623924457401,
                "variance": 3594.9166666666665,
                "coeff_var": 23.935179211360243,
                "sum": 3201390,
                "first_quartile": 200,
                "median": 250.5,
                "percentiles": [{"percentile": 90, "value": 330}],
                "third_quartile": 300,
            },
]

@github-actions github-actions bot added raster Related to raster data processing Python Related code is in Python C Related code is in C module docs markdown Related to markdown, markdown files tests Related to Test Suite HTML Related code is in HTML labels May 20, 2025
Signed-off-by: Nishant Bansal <[email protected]>
Signed-off-by: Nishant Bansal <[email protected]>
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

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

Thanks, that fixes the issue. Could you please add a simple example in Python with parse_command? Maybe not at the end, but sooner, e.g. in the first example (univariate statistics).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C docs HTML Related code is in HTML imagery libraries markdown Related to markdown, markdown files module Python Related code is in Python raster Related to raster data processing tests Related to Test Suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] r.univar: fix json structure
2 participants