LoopStructural.datatypes.StructuredGrid#

class LoopStructural.datatypes.StructuredGrid(origin: ~numpy.ndarray = <factory>, step_vector: ~numpy.ndarray = <factory>, nsteps: ~numpy.ndarray = <factory>, cell_properties: ~typing.Dict[str, ~numpy.ndarray] = <factory>, properties: ~typing.Dict[str, ~numpy.ndarray] = <factory>, name: str = 'default_grid')#

Bases: object

A structured grid for storing 3D geological data.

This class represents a regular 3D grid with properties and cell properties that can be used for geological modelling and visualisation.

Parameters:
  • origin (np.ndarray, optional) – Origin point of the grid, by default [0, 0, 0]

  • step_vector (np.ndarray, optional) – Step size in each direction, by default [1, 1, 1]

  • nsteps (np.ndarray, optional) – Number of steps in each direction, by default [10, 10, 10]

  • cell_properties (Dict[str, np.ndarray], optional) – Properties defined at cell centres, by default empty dict

  • properties (Dict[str, np.ndarray], optional) – Properties defined at grid nodes, by default empty dict

  • name (str, optional) – Name of the grid, by default “default_grid”

__init__(origin: ~numpy.ndarray = <factory>, step_vector: ~numpy.ndarray = <factory>, nsteps: ~numpy.ndarray = <factory>, cell_properties: ~typing.Dict[str, ~numpy.ndarray] = <factory>, properties: ~typing.Dict[str, ~numpy.ndarray] = <factory>, name: str = 'default_grid') None#

Methods

__init__([origin, step_vector, nsteps, ...])

merge(other)

plot([pyvista_kwargs])

Calls pyvista plot on the vtk object

save(filename, *[, group])

to_dict()

Convert the structured grid to a dictionary representation.

vtk()

Convert the structured grid to a PyVista RectilinearGrid.

Attributes

cell_centres

Calculate the coordinates of cell centres.

maximum

Calculate the maximum coordinates of the grid.

name

nodes

origin

step_vector

nsteps

cell_properties

properties

property cell_centres#

Calculate the coordinates of cell centres.

Returns:

tuple of np.ndarray – X, Y, Z coordinates of all cell centres

property maximum#

Calculate the maximum coordinates of the grid.

Returns:

np.ndarray – Maximum coordinates (origin + nsteps * step_vector)

plot(pyvista_kwargs={})#

Calls pyvista plot on the vtk object

Parameters:

pyvista_kwargs (dict, optional) – kwargs passed to pyvista.DataSet.plot(), by default {}

to_dict()#

Convert the structured grid to a dictionary representation.

Returns:

dict – Dictionary containing all grid properties and metadata

vtk()#

Convert the structured grid to a PyVista RectilinearGrid.

Returns:

pv.RectilinearGrid – PyVista grid object with all properties attached

Raises:

ImportError – If PyVista is not installed