@@ -99,12 +99,17 @@ GeoUtils provides support for grouped statistics, allowing statistics to be comp
9999defined by one or more grouping bins. This is particularly useful when analyzing how statistical properties vary
100100across classes, bins, or segmentation derived from the data itself.
101101
102- Example of grouped statistics according elevation values
102+
103+ ### Example with altitude intervals
104+ In this example, we will create different altitude classes from a chosen interval [ 400, 1000, 2000, 3000, >3000] .
105+ Once these bins are created, we reapply them and compute the mean, minimum, and maximum values of the same raster
106+ for each sub-interval. It is also possible to use a reference other than the raster itself for the group_by.
107+
103108``` {code-cell} ipython3
104109from geoutils.stats import grouped_stats
105110
106111group_by = {"rast": rast}
107- bins = {"rast": [100 , 1000, 2000, 3000, np.inf]}
112+ bins = {"rast": [400 , 1000, 2000, 3000, np.inf]}
108113to_aggregate = {"rast": rast}
109114statistics = ["mean", "min", "max"]
110115
@@ -117,7 +122,13 @@ Bins can be presented in different ways. It is possible to integrate an interval
117122segmentation map in raster format.
118123```
119124
120- Example of grouped statistics according elevation values as mask
125+
126+ ### Example with altitude masks
127+
128+ In this example, we will create a mask such as altitude is more than 2000 meters.
129+ Once these masks are created as a raster, we reapply them and compute the mean, minimum, and maximum values of the same raster
130+ for masks = True. It is also possible to use a reference other than the raster itself for the group_by.
131+
121132``` {code-cell} ipython3
122133from geoutils.stats import grouped_stats
123134
@@ -127,7 +138,7 @@ bins = {"rast": elev_mask}
127138to_aggregate = {"rast": rast}
128139statistics = ["mean", "min", "max"]
129140
130- df = grouped_stats.grouped_stats(group_by, bins, to_aggregate, statistics)
141+ df = grouped_stats.grouped_stats(group_by, bins, to_aggregate, statistics, save_masks="" )
131142df
132143```
133144
0 commit comments