geost.models.model_array.ModelDataArray.select_within_bbox#
- ModelDataArray.select_within_bbox(xmin: int | float, ymin: int | float, xmax: int | float, ymax: int | float, crs: str | int | CRS | None = None) xr.Dataset | xr.DataArray#
Select data within a specified bounding box (xmin, ymin, xmax, ymax). This method needs the model to have a valid coordinate reference system (CRS) defined.
- Parameters:
xmin (float | int) – Minimum x-coordinate of the bounding box.
ymin (float | int) – Minimum y-coordinate of the bounding box.
xmax (float | int) – Maximum x-coordinate of the bounding box.
ymax (float | int) – Maximum y-coordinate of the bounding box.
crs (str | int | CRS | None, optional) – Coordinate reference system of the bounding box. If None, the CRS of the bounding box is assumed to be the same as the dataset.
- Returns:
Subset of the original dataset or data array within the specified bounding box.
- Return type:
xr.Dataset | xr.DataArray
- Raises:
ValueError – If no data is found within the specified bounding box.