Skip to content

Commit

Permalink
Update documentation for ROI and stats (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
vschaffn authored Feb 27, 2025
1 parent 0b878cf commit 256cbf2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- tqdm
- scikit-image=0.*
- scikit-gstat>=1.0.18,<1.1
- geoutils=0.1.12
- geoutils=0.1.13
- affine
- pandas
- pyogrio
Expand Down
22 changes: 22 additions & 0 deletions doc/source/dem_class.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ slope.plot(cmap="Reds", cbar_title="Slope (°)")
For the full list of terrain attributes, see the {ref}`terrain-attributes` page.
```

## Statistics
The [`get_stats()`](https://geoutils.readthedocs.io/en/latest/gen_modules/geoutils.Raster.get_stats.html) method allows to extract key statistical information from a raster in a dictionary.

- Get all statistics in a dict:
```{code-cell} ipython3
dem.get_stats()
```

The DEM statistics functionalities in `xdem` are based on those in `geoutils`.
For more information on computing statistics, please refer to the [`geoutils` documentation](https://geoutils.readthedocs.io/en/latest/raster_class.html#obtain-statistics).


Note: as [`get_stats()`](https://geoutils.readthedocs.io/en/latest/gen_modules/geoutils.Raster.get_stats.html) is a raster method, it can also be used for terrain attributes:
```{code-cell} ipython3
slope.get_stats()
```

## Coregistration

3D coregistration is performed with {func}`~xdem.DEM.coregister_3d`, which aligns the
Expand Down Expand Up @@ -182,3 +199,8 @@ We use `random_state` to ensure a fixed randomized output. It is **only necessar
For more details on quantifying random and structured errors, see the {ref}`uncertainty` page.
```

## Cropping a DEM

The DEM cropping functionalities in `xdem` are based on those in `geoutils` ([`crop()`](https://geoutils.readthedocs.io/en/latest/gen_modules/geoutils.Raster.crop.html#geoutils.Raster.crop), [`icrop()`](https://geoutils.readthedocs.io/en/latest/gen_modules/geoutils.Raster.icrop.html#geoutils.Raster.icrop)).
For more information on using cropping functions, please refer to the [`geoutils` documentation](https://geoutils.readthedocs.io/en/latest/raster_class.html#crop).
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- tqdm
- scikit-image=0.*
- scikit-gstat>=1.0.18,<1.1
- geoutils=0.1.12
- geoutils=0.1.13
- pip
- affine
- pandas
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ scipy==1.*
tqdm
scikit-image==0.*
scikit-gstat>=1.0.18,<1.1
geoutils==0.1.12
geoutils==0.1.13
pip
affine
pandas
Expand Down
1 change: 1 addition & 0 deletions xdem/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def from_array(
compatible. If False, will raise an error when incompatible.
:param vcrs: Vertical coordinate reference system.
:returns: DEM created from the provided array and georeferencing.
"""
# We first apply the from_array of the parent class
Expand Down

0 comments on commit 256cbf2

Please sign in to comment.