geost.bro.bro_geotop.GeoTop.slice_depth_interval#

GeoTop.slice_depth_interval(upper: int | float | DataArray = None, lower: int | float | DataArray = None, how: Literal['overlap', 'majority', 'inner'] = 'overlap', drop: bool = True)#

Slice a specified depth interval from the VoxelModel between upper and lower bounds.

Parameters:
  • upper (int | float | xr.DataArray, optional) – Upper and/or lower bound of the depth interval. This can be a single value or a 1D or 2D DataArray containing variable depths. In case of a DataArray, a 1D DataArray should contain either the “x” or “y” dimension and a 2D DataArray should contain both “x” and “y” dimensions. Otherwise broadcasting cannot be done correctly and the slicing cannot be done. The default is None.

  • lower (int | float | xr.DataArray, optional) – Upper and/or lower bound of the depth interval. This can be a single value or a 1D or 2D DataArray containing variable depths. In case of a DataArray, a 1D DataArray should contain either the “x” or “y” dimension and a 2D DataArray should contain both “x” and “y” dimensions. Otherwise broadcasting cannot be done correctly and the slicing cannot be done. The default is None.

  • drop (bool, optional) – If True, depths where the result only contains missing values will be dropped from the slice result. If False, the original shape is kept. The default is True.

  • how ({"overlap", "majority", "inner"}, optional) –

    Method to use for slicing. The default is “overlap”. - “overlap”: Include voxels that at least partially overlap with the specified

    depth interval.

    • ”majority”: Include voxels that have 50% or more of their volume within the specified depth interval.

    • ”inner”: Include only voxels that are completely within the specified depth interval.

Returns:

New VoxelModel with the slice result.

Return type:

VoxelModel

Raises:

TypeError – When upper or lower are not int, float or xr.DataArray.

Examples

Slice a fixed depth interval between -10 and -20:

>>> sliced = voxelmodel.slice_depth_interval(upper=-10, lower=-20)

Slice a VoxelModel of 2 rows and 2 columns between variable depth intervals using DataArrays.

>>> upper = xr.DataArray([[-10, -15], [-12, -18]], dims=("y", "x"))
>>> upper  # 2D array with different depth interval for each "x" and "y"
<xarray.DataArray (y: 2, x: 2)>
array([[-15, -20],
       [-17, -23]])
Dimensions without coordinates: y, x
>>> sliced = voxelmodel.slice_depth_interval(upper=upper, lower=upper - 5)
>>> upper = xr.DataArray([-10, -15], dims=("y",)) # slice along "y"
>>> upper  # 1D array with different depth interval for each "y" but the same for every "x"
<xarray.DataArray (y: 2)>
array([-15, -20])
Dimensions without coordinates: y
>>> sliced = voxelmodel.slice_depth_interval(upper=upper, lower=upper - 5)