Skip to content

Commit

Permalink
docs: add ROI to dem_class
Browse files Browse the repository at this point in the history
  • Loading branch information
vschaffn committed Jan 23, 2025
1 parent 3ba9df2 commit fa886f6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion doc/source/dem_class.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def custom_stat(data):
dem.get_stats(custom_stat)
```

Note : as `get_stats()` is a raster method, it can also be used for terrain attributes:
Note: as `get_stats()` is a raster method, it can also be used for terrain attributes:
```{code-cell} ipython3
slope.get_stats()
```
Expand Down Expand Up @@ -214,3 +214,18 @@ 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.
```

## Region of interest (ROI)
To limit DEM comparison to a Region Of Interest (ROI) one can set a bounding box in terrain geometry or part of the DEM with image coordinates:

The `roi` can be specified in two formats:
- **Pixel-based ROI:** Defined by the pixel coordinates with the following keys: `x`, `y`, `w`, and `h`, where (`x`, `y`) top-left corner coordinates and (`w`, `h`) the dimensions (width, height) in pixels.
- **Georeferenced ROI:** Defined by geographical coordinates with the following keys: `left`, `bottom`, `right`, `top` and optional `crs` (Coordinate Reference System, defaults to EPSG:4326 if not provided).

```{code-cell} ipython3
# Initialize a DEM with a pixel-based ROI
dem = xdem.DEM(filename_dem, roi={'x': 50, 'y': 100, 'w': 400, 'h': 300})
# Initialize a DEM with a georeferenced ROI
dem = xdem.DEM(filename_dem, roi={'left': 503810, 'bottom': 8666030, 'top': 8672030, 'right': 511810, 'crs': 'EPSG:25833'})
```

0 comments on commit fa886f6

Please sign in to comment.