ogstools.meshlib package#
- class ogstools.meshlib.Surface[source]#
Bases:
object
A surface is a sub group of a polygon mesh (2D). A surface is not closed and therefore does not represent a volume. (Geological) layers (stratigraphic units) can be defined by an upper and lower surface. By convention, properties (material_id and resolution ), actually associated to the stratigraphic unit layer, are given together with the lower boundary (class Surface) of a stratigraphic unit (class Layer).
Initialize a surface mesh. Either from pyvista or from a file.
- property material_id: int#
- class ogstools.meshlib.Layer[source]#
Bases:
Boundary
Layer(top: ogstools.meshlib.boundary_subset.Surface, bottom: ogstools.meshlib.boundary_subset.Surface, material_id: int = 0, num_subdivisions: int = 0)
- material_id: int = 0#
- num_subdivisions: int = 0#
Class representing a geological layer with top and bottom surfaces.
A geological layer is a distinct unit of rock or sediment that has unique properties and characteristics, associated by the material_id. It is often bounded by two surfaces: the top surface and the bottom surface. These surfaces delineate the spatial extent of the layer in the GIS system.
- create_raster(resolution)[source]#
Create raster representations for the layer.
For each surface, including intermediate surfaces (num_of_subdivisions > 0), this method generates .asc files.
- Args:
resolution (float): The resolution for raster creation.
- Returns:
list[Path]: A list of filenames to .asc raster files.
- Parameters:
resolution (float) –
- Return type:
list[Path]
- class ogstools.meshlib.Raster[source]#
Bases:
object
Class representing a raster representation of a location frame.
This class provides methods to create and save a raster representation based on a specified location frame and resolution.
- frame: LocationFrame#
- resolution: float#
- __init__(frame, resolution)#
- Parameters:
frame (LocationFrame) –
resolution (float) –
- Return type:
None
- as_vtu(outfilevtu)[source]#
Create and save a raster representation as a VTK unstructured grid.
- Args:
outfilevtu (Path): The path to save the VTK unstructured grid representation.
- Returns:
Path: The path to the saved VTK unstructured grid representation.
- Parameters:
outfilevtu (Path) –
- Return type:
Path
- class ogstools.meshlib.LocationFrame[source]#
Bases:
object
LocationFrame(xmin: float, xmax: float, ymin: float, ymax: float)
- xmin: float#
- xmax: float#
- ymin: float#
- ymax: float#
- as_gml(filename)[source]#
Generate GML representation of the location frame.
- Args:
filename (Path): The filename to save the GML representation to.
- Returns:
None
- Parameters:
filename (Path) –
- __init__(xmin, xmax, ymin, ymax)#
- Parameters:
xmin (float) –
xmax (float) –
ymin (float) –
ymax (float) –
- Return type:
None
- class ogstools.meshlib.Boundary[source]#
Bases:
ABC
Abstract base class representing a boundary within a mesh.
A boundary refers to the set of edges or faces that defines the delineation between the interior region and exterior regions of a mesh. In a 2D mesh, it is formed by a closed collection of line segments (1D). In a 3D mesh, it is formed by a closed collection of faces (2D).
- class ogstools.meshlib.MeshSeries[source]#
Bases:
object
A wrapper around pyvista and meshio for reading of pvd and xdmf timeseries.
Will be replaced by own module in ogstools with similar interface.
- read(timestep, lazy_eval=True)[source]#
Lazy read function.
- Parameters:
timestep (int) –
lazy_eval (bool) –
- Return type:
UnstructuredGrid
- property timesteps: range#
Return the timesteps of the timeseries data.
- property timevalues: list[float]#
Return the timevalues of the timeseries data.
- closest_timestep(timevalue)[source]#
Return the corresponding timestep from a timevalue.
- Parameters:
timevalue (float) –
- Return type:
int
- closest_timevalue(timevalue)[source]#
Return the closest timevalue to a timevalue.
- Parameters:
timevalue (float) –
- Return type:
float
- class ogstools.meshlib.LayerSet[source]#
Bases:
BoundarySet
Collection of geological layers stacked to represent subsurface arrangements.
In a geological information system, multiple layers can be stacked vertically to represent the subsurface arrangement. This class provides methods to manage and work with layered geological data.
Initializes a LayerSet. It checks if the list of provided layers are given in a top to bottom order. In neighboring layers, layers share the same surface (upper bottom == low top).
- __init__(layers)[source]#
Initializes a LayerSet. It checks if the list of provided layers are given in a top to bottom order. In neighboring layers, layers share the same surface (upper bottom == low top).
- Parameters:
layers (list[Layer]) –
- classmethod from_pandas(df)[source]#
Create a LayerSet from a Pandas DataFrame.
- Parameters:
df (DataFrame) –
- ogstools.meshlib.rect(lengths=1.0, n_edge_cells=1, structured_grid=True, order=1, out_name=Path('unit_square.msh'))[source]#
- Parameters:
lengths (float | list[float]) –
n_edge_cells (int | list[int]) –
structured_grid (bool) –
order (int) –
out_name (Path) –
- ogstools.meshlib.cuboid(lengths=1.0, n_edge_cells=1, structured_grid=True, order=1, out_name=Path('unit_cube.msh'))[source]#
- Parameters:
lengths (float | list[float]) –
n_edge_cells (int | list[int]) –
structured_grid (bool) –
order (int) –
out_name (Path) –