grass icon indicating copy to clipboard operation
grass copied to clipboard

r.univar: add JSON support

Open kritibirda opened this issue 1 year ago • 3 comments

Use parson to add json output format support to the r.univar module.

Expected JSON schema:

At the root is an array, each element of which has the stats for a given zone. The percentile option allows the user to request specific percentiles which are written for each zone object as percentile_%d keys.

[
    {
        "zone_number": <int>,
        "zone_category": <string>,
        "n": <int>,
        "null_cells": <int>,
        "cells": <int>,
        "min": <double>,
        "max": <double>,
        "range": <double>,
        "mean": <double>,
        "mean_of_abs": <double>,
        "stddev": <double>,
        "variance": <double>,
        "coeff_var": <double>,
        "sum": <double>,
        "first_quartile": <double>,
        "median": <double>,
        "third_quartile": <double>,
        "percentile_98": <double>
    }
]

kritibirda avatar Jun 07 '24 12:06 kritibirda

Can you please compare this schema to what db.univar generates? Maybe they don't need to be the same, but if they are not, we need to have a good reason for that.

wenzeslaus avatar Jun 07 '24 13:06 wenzeslaus

@wenzeslaus Can you please point me to the db.univar module, I am unable to find it.

kritibirda avatar Jun 07 '24 14:06 kritibirda

@wenzeslaus Can you please point me to the db.univar module, I am unable to find it.

https://github.com/OSGeo/grass/tree/f13b37931af919be04fa14f392a1f9ea9aa183fd/scripts/db.univar

echoix avatar Jun 07 '24 14:06 echoix

@cwhite911 updated.

kritibirda avatar Jul 02 '24 12:07 kritibirda