You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/raster_class.md
+36-5Lines changed: 36 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -260,14 +260,14 @@ The {func}`~geoutils.Raster.icrop` function accepts only a bounding box in pixel
260
260
By default, {func}`~geoutils.Raster.crop` and {func}`~geoutils.Raster.icrop` return a new Raster unless the inplace parameter is set to True, in which case the cropping operation is performed directly on the original raster object.
261
261
For more details, see the {ref}`specific section and function descriptions in the API<api-geo-handle>`.
262
262
263
-
### Example for `crop`
263
+
### Example for {func}`~geoutils.Raster.crop`
264
264
```{code-cell} ipython3
265
265
# Crop raster to smaller bounds
266
266
rast_crop = rast.crop(bbox=(0.3, 0.3, 1, 1))
267
267
print(rast_crop.bounds)
268
268
```
269
269
270
-
### Example for `icrop`
270
+
### Example for {func}`~geoutils.Raster.icrop`
271
271
```{code-cell} ipython3
272
272
# Crop raster using pixel coordinates
273
273
rast_icrop = rast.icrop(bbox=(2, 2, 6, 6))
@@ -360,8 +360,31 @@ rast_reproj.to_xarray()
360
360
```
361
361
362
362
## Obtain Statistics
363
-
The `get_stats()` method allows to extract key statistical information from a raster in a dictionary.
364
-
Supported statistics are : mean, median, max, mean, sum, sum of squares, 90th percentile, nmad, rmse, std.
363
+
The {func}`~geoutils.Raster.get_stats` method allows to extract key statistical information from a raster in a dictionary.
364
+
Supported statistics are :
365
+
-**Mean:** arithmetic mean of the data, ignoring masked values.
366
+
-**Median:** middle value when the valid data points are sorted in increasing order, ignoring masked values.
367
+
-**Max:** maximum value among the data, ignoring masked values.
368
+
-**Min:** minimum value among the data, ignoring masked values.
369
+
-**Sum:** sum of all data, ignoring masked values.
370
+
-**Sum of squares:** sum of the squares of all data, ignoring masked values.
371
+
-**90th percentile:** point below which 90% of the data falls, ignoring masked values.
372
+
-**LE90 (Linear Error with 90% confidence):** Difference between the 95th and 5th percentiles of a dataset, representing the range within which 90% of the data points lie. Ignore masked values.
373
+
-**NMAD (Normalized Median Absolute Deviation):** robust measure of variability in the data, less sensitive to outliers compared to standard deviation. Ignore masked values.
374
+
-**RMSE (Root Mean Square Error):** commonly used to express the magnitude of errors or variability and can give insight into the spread of the data. Only relevant when the raster represents a difference of two objects. Ignore masked values.
375
+
-**Std (Standard deviation):** measures the spread or dispersion of the data around the mean, ignoring masked values.
376
+
-**Valid count:** number of finite data points in the array. It counts the non-masked elements.
377
+
-**Total count:** total size of the raster.
378
+
-**Percentage valid points:** ratio between **Valid count** and **Total count**.
379
+
380
+
381
+
If an inlier mask is passed:
382
+
-**Total inlier count:** number of data points in the inlier mask.
383
+
-**Valid inlier count:** number of unmasked data points in the array after applying the inlier mask.
384
+
-**Percentage inlier points:** ratio between **Valid inlier count** and **Valid count**. Useful for classification statistics.
385
+
-**Percentage valid inlier points:** ratio between **Valid inlier count** and **Total inlier count**.
386
+
387
+
365
388
Callable functions are supported as well.
366
389
367
390
### Usage Examples:
@@ -377,7 +400,7 @@ rast.get_stats("mean")
377
400
378
401
- Get multiple statistics in a dict:
379
402
```{code-cell} ipython3
380
-
rast.get_stats(["mean", "max", "rmse"])
403
+
rast.get_stats(["mean", "max", "std"])
381
404
```
382
405
383
406
- Using a custom callable statistic:
@@ -386,3 +409,11 @@ def custom_stat(data):
386
409
return np.nansum(data > 100) # Count the number of pixels above 100
0 commit comments