Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5d7eef3
add: print
marinebcht Jun 2, 2026
968c55f
add: resampling and interpolation method as global param
marinebcht Jun 3, 2026
999dd02
add: info in docstring
marinebcht Jun 3, 2026
0d94a80
add: test for multiraster
marinebcht Jun 4, 2026
1deca0a
add: test for multiraster
marinebcht Jun 4, 2026
125bc41
complete tests and docstring
marinebcht Jun 4, 2026
6b91954
type: ignore to show mypy error
marinebcht Jun 4, 2026
b452d35
pre-commit
marinebcht Jun 4, 2026
4c43c48
remove modification for the useless precommit errors
marinebcht Jun 4, 2026
1996ec3
modify: resample_ to reprojection_method
marinebcht Jun 8, 2026
833ec01
add: dist_nodata_spread
marinebcht Jun 8, 2026
dd94083
fix: docstrings and co
marinebcht Jun 8, 2026
85fe9a5
add: info 'in config.ici'
marinebcht Jun 9, 2026
d26808d
Bump conda-incubator/setup-miniconda from 3 to 4 (#883)
dependabot[bot] Apr 27, 2026
b9b4f3c
Improve get_stats with stats name no more (case) sensitive (#887)
marinebcht Jun 5, 2026
1354806
remove print + add ('or' in config.ini)
marinebcht Jun 17, 2026
2967a57
Merge branch 'main' into 884_global_param
marinebcht Jun 17, 2026
99dc616
review 1/2 romain
marinebcht Jun 23, 2026
9d21331
del: np.float + add: min list
marinebcht Jun 30, 2026
d47eb79
fix: tests
marinebcht Jul 6, 2026
22abeec
remove prints
marinebcht Jul 6, 2026
8a18b37
fix: if/else
marinebcht Jul 6, 2026
74dde1f
review romain
marinebcht Jun 30, 2026
ff0dcf1
fix: CI
marinebcht Jun 30, 2026
77d1709
change name valiable
marinebcht Jul 6, 2026
b3504aa
fix: pre-commit
marinebcht Jul 6, 2026
391351c
Update .readthedocs.yaml
marinebcht Jul 31, 2026
b7eb251
Update .readthedocs.yaml
marinebcht Jul 31, 2026
6c0466b
Bump actions/checkout from 6 to 7 (#889)
dependabot[bot] Jun 29, 2026
cbcb19b
Bump actions/cache from 5 to 6 (#890)
dependabot[bot] Jun 29, 2026
2544ca2
Bump actions/setup-python from 6 to 7 (#894)
dependabot[bot] Jul 21, 2026
5aa4ce3
Update CLI doc page to new Sphing-Argparse path behaviour (#897)
rhugonnet Jul 26, 2026
fd10430
Fix interp_points returning NaN for valid points on non-square raster…
dshean Jul 26, 2026
804b99e
Add some parameters as global parameters (#888)
marinebcht Jul 31, 2026
d0eefb4
Merge branch 'main' into 800_get_stats
marinebcht Jul 31, 2026
48d29ff
add: doc
marinebcht Aug 3, 2026
64c66b4
fix: doc
marinebcht Aug 3, 2026
0ff8c09
Update base.py - prop Valentine
marinebcht Aug 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion doc/source/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ rast = gu.Raster(filename_rast)
rast
```

Get all default statistics:
By default and without any specification, this function computes the following main statistics:
minimum, maximum, mean, standard deviation, NMAD, total count, and percentage of valid points.
```{code-cell} ipython3
rast.get_stats()
```

To compute all available statistics, set `stats_name` to `all`.
```{code-cell} ipython3
rast.get_stats("all")
```

Get a single statistic (e.g., 'mean') as a float:
```{code-cell} ipython3
rast.get_stats("mean")
Expand Down
12 changes: 8 additions & 4 deletions geoutils/pointcloud/pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from __future__ import annotations

import logging
import os.path
import pathlib
import warnings
Expand Down Expand Up @@ -1424,12 +1423,17 @@ def get_stats(

Callable functions are supported as well.

:param stats_name: Name or list of names of the statistics to retrieve. If None, all statistics are returned.
By default and without any specification, this function computes the following main statistics: minimum,
maximum, mean, standard deviation, NMAD, total count, and percentage of valid points.
To compute all available statistics, set `stats_name` to `all`.

:param stats_name: Name or list of names of the statistics to retrieve. If None, main statistics are returned.
Accepted names include:
`mean`, `median`, `max`, `min`, `sum`, `sum of squares`, `90th percentile`, `LE90`, `nmad`, `rmse`,
`std`, `valid count`, `total count`, `percentage valid points` and if an inlier mask is passed :
`valid inlier count`, `total inlier count`, `percentage inlier point`, `percentage valid inlier points`.
Custom callables can also be provided.
To compute all available statistics, set `stats_name` to `all`.
:returns: The requested statistic or a dictionary of statistics if multiple or all are requested.
"""

Expand All @@ -1440,7 +1444,7 @@ def get_stats(
data = self.data

# Given list or all attributes to compute if None
if isinstance(stats_name, list) or stats_name is None:
if isinstance(stats_name, list) or stats_name is None or stats_name == "all":
return _statistics(data, stats_name) # type: ignore
else:
# Single attribute to compute
Expand All @@ -1449,7 +1453,7 @@ def get_stats(
elif callable(stats_name):
return stats_name(data) # type: ignore
else:
logging.warning("Statistic name '%s' is a not recognized string", stats_name)
warnings.warn("Statistic name " + str(stats_name) + " is a not recognized string", category=UserWarning)
Comment thread
marinebcht marked this conversation as resolved.

@overload
def subsample(
Expand Down
12 changes: 8 additions & 4 deletions geoutils/raster/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ def get_stats(
- Std (Standard deviation): measures the spread or dispersion of the data around the mean, \
ignoring masked values.
- Valid count: number of finite data points in the array. It counts the non-masked elements.
- Total count: total size of the raster.
- Total count: total size (width x height) of the raster.
- Percentage valid points: ratio between Valid count and Total count.

For all statistics up to and including "Std", NumPy Masked functions are used (directly or in the calculation)
Expand All @@ -749,12 +749,17 @@ def get_stats(

Callable functions are supported as well.

:param stats_name: Name or list of names of the statistics to retrieve. If None, all statistics are returned.
By default and without any specification, this function computes the following main statistics: minimum,
maximum, mean, standard deviation, NMAD, total count, and percentage of valid points.
To compute all available statistics, set `stats_name` to `all`.

:param stats_name: Name or list of names of the statistics to retrieve. If None, main statistics are returned.
Accepted names include:
`mean`, `median`, `max`, `min`, `sum`, `sum of squares`, `90th percentile`, `iqr`, `LE90`, `nmad`, `rmse`,
`std`, `valid count`, `total count`, `percentage valid points` and if an inlier mask is passed :
`valid inlier count`, `total inlier count`, `percentage inlier point`, `percentage valid inlier points`.
Custom callables can also be provided.
To compute all available statistics, set `stats_name` to `all`.
:param inlier_mask: Mask or boolean array of areas to include (inliers=True).
:param band: The index of the band for which to compute statistics. Default is 1.
:param counts: (number of finite data points in the array, number of valid points (=True, to keep)
Expand Down Expand Up @@ -784,7 +789,7 @@ def get_stats(
return rast.get_stats(stats_name=stats_name, band=band, counts=(valid_points, inlier_points))

# Given list or all attributes to compute if None
if isinstance(stats_name, list) or stats_name is None:
if isinstance(stats_name, list) or stats_name is None or stats_name == "all":
return _statistics(data, stats_name, counts) # type: ignore
else:
# Single attribute to compute
Expand Down Expand Up @@ -880,7 +885,6 @@ def _raster_equal_allclose(

if not complete_equality and warn_failure_reason:
where_fail = np.nonzero(~np.array(equalities))[0]
print(f"Equality failed for: {', '.join([names[w] for w in where_fail])}.")
warnings.warn(
category=UserWarning, message=f"Equality failed for: {', '.join([names[w] for w in where_fail])}."
)
Expand Down
Loading
Loading