ModelDataArray#

This is the GeoST extension for xarray.DataArray. Available after importing geost. For example:

import numpy as np
import xarray as xr

import geost

# Create example model data array with 3D data
da = xr.DataArray(
    np.random.rand(3, 3, 4),
    dims=("y", "x", "z"),
    coords={"y": [2, 1, 0], "x": [0, 1, 2], "z": [0, 1, 2, 3]},
)
da.gst
# Output:
# <geost.models.model_array.ModelDataArray at 0x7f8c4e4c0d30>

Analysis#

ModelDataArray.get_thickness(condition)

Calculate the thickness where a voxelmodel or layermodel meets a specified condition.

ModelDataArray.get_top_bottom(condition)

Derive the top and bottom depths at each x,y-location of a specified condition from a voxelmodel or layermodel.

ModelDataArray.most_common([return_thickness])

Determine the "most common" value and corresponding thickness in a voxelmodel or a layermodel.

ModelDataArray.value_counts([dim, normalize])

Get the value counts of unique values in a DataArray.

ModelDataArray.unique()

Get the unique values in a DataArray without NaNs.

Coordinate Reference System#

ModelDataArray.write_crs(crs[, inplace])

Write the coordinate reference system (CRS) to the model.

Export#

ModelDataArray.to_collection()

Create a Collection from the model data.

ModelDataArray.to_geopackage_3d(filepath)

Write data to geopackage file containing a layer "locations" with point geometries and a layer "3dlines" with 3D line geometries.

ModelDataArray.to_pyvista_grid([data_vars, ...])

Convert the model to a PyVista grid.

General#

ModelDataArray.bounds()

Determine the bounding box of the model.

ModelDataArray.resolution([meters])

Determine the resolution of the model.

ModelDataArray.vertical_bounds()

Determine the vertical bounds (depth min, depth max) of the model.

Selection#

ModelDataArray.slice_depth_interval([upper, ...])

Slice a specified depth interval from a voxelmodel or layermodel between upper and lower bounds.

ModelDataArray.slice_xy(xmin, ymin, xmax, ymax)

Slice the model in the x and y dimensions.

Spatial#

ModelDataArray.mask_geometries(geometries[, ...])

Mask 'x','y'-locations that overlap with geometries (points, lines, polygons).

ModelDataArray.select_points(points[, crs, ...])

Select model data at specified point locations.

ModelDataArray.select_along_lines(lines[, ...])

Select model data at specified distances along given line geometries.

ModelDataArray.select_within_bbox(xmin, ...)

Select data within a specified bounding box (xmin, ymin, xmax, ymax).

Attributes#

ModelDataArray.bottom

xarray.DataArray with the depths of the bottom of each layer in a layermodel.

ModelDataArray.crs

The Coordinate Reference System (CRS) represented as a pyproj.CRS object.

ModelDataArray.model_type

The type of the model as a ModelType enum member.

ModelDataArray.ndims

The number of dimensions in the Dataset/DataArray

ModelDataArray.shape

The shape of the model as a tuple of integers with the size of each dimension.

ModelDataArray.surface_level

xarray.DataArray with the surface level elevation of the model.

ModelDataArray.top

xarray.DataArray with the depths of the top of each layer in a layermodel.

ModelDataArray.x

The x coordinates of the model as an xarray.DataArray.

ModelDataArray.x_dim

The name of the x dimension in the Dataset/DataArray

ModelDataArray.y

The y coordinates of the model as an xarray.DataArray.

ModelDataArray.y_dim

The name of the y dimension in the Dataset/DataArray

ModelDataArray.z

The coordinates of the model's vertical dimension as an xarray.DataArray.

ModelDataArray.z_dim

The name of the z dimension in the Dataset/DataArray