ogstools.meshlib package#
- 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).
- ogstools.meshlib.Gaussian2D(bound2D, amplitude, spread, height_offset, n)[source]#
Generate a 2D Gaussian-like surface using the provided parameters.
This method computes a 2D Gaussian-like surface by sampling the given bound and parameters.
- Args:
bound2D (tuple): Tuple of boundary coordinates (x_min, x_max, y_min, y_max). amplitude (float): Amplitude or peak value of the Gaussian curve. spread (float): Scaling factor that controls the spread or width of the Gaussian curve. height_offset (float): Constant offset added to elevate the entire surface. n (int): Number of points in each dimension for sampling.
- Returns:
pyvista.PolyData: A PyVista PolyData object representing the generated surface.
- Note:
The larger amplitude, the taller the peak of the surface.
The larger spread, the wider and flatter the surface.
height_offset shifts the entire surface vertically.
- Example:
Generating a 2D Gaussian-like surface:
` bound = (-1.0, 1.0, -1.0, 1.0) amplitude = 1.0 spread = 0.5 height_offset = 0.0 n = 100 surface = MyClass.Gaussian2D(bound, amplitude, spread, height_offset, n) `
- Return type:
DataSet
- 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.
- Return type:
list[Path]
- dim()[source]#
Get the dimension of the boundary.
- Returns:
int: The dimension of the boundary. For example, the dimension of a boundary of a cube (3D) is 2.
- Return type:
int
- __init__(top, bottom, material_id=0, num_subdivisions=0)#
- 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).
- 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
- __init__(xmin, xmax, ymin, ymax)#
- class ogstools.meshlib.Mesh[source]#
Bases:
UnstructuredGrid
A wrapper around pyvista.UnstructuredGrid.
Contains additional data and functions mainly for postprocessing.
Initialize a Mesh object
- param pv_mesh:
Underlying pyvista mesh.
- param data_length_unit:
Length unit of the mesh data.
- param output_length_unit:
Length unit in plots.
- filepath: Path | None = None#
- difference(subtract_mesh, variable=None)#
Compute the difference of variables between two meshes.
- Parameters:
subtract_mesh (Mesh) – The mesh whose data is to be subtracted.
variable (Variable | str | None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Returns:
A new mesh containing the difference of variable or of all datasets between both meshes.
- Return type:
Mesh
- depth(use_coords=False)#
Returns the depth values of the mesh.
For 2D, the last axis of the plane wherein the mesh is lying is used as the vertical axis (i.e. y if the mesh is in the xy-plane, z if it is in the xz-plane), for 3D, the z-axes is used. If use_coords is True, returns the negative coordinate value of the vertical axis. Otherwise, the vertical distance to the top facing edges surfaces are returned.
- Return type:
ndarray
- p_fluid()#
Return the fluid pressure in the mesh.
If “depth” is given in the mesh’s point _data, it is used return a hypothetical water column defined as:
\[p_{fl} = 1000 \frac{kg}{m^3} 9.81 \frac{m}{s^2} h\]where h is the depth below surface. Otherwise, If “pressure” is given in the mesh, return the “pressure” data of the mesh. If that is also not the case, the hypothetical water column from above is returned with the depth being calculated via
ogstools.meshlib.geo.depth()
.- Return type:
PlainQuantity
- plot_contourf(variable, fig=None, ax=None, **kwargs)#
Plot the variable field of meshes with default settings.
The resulting figure adheres to the configurations in plot.setup. For 2D, the whole domain, for 3D a set of slices is displayed.
- Parameters:
variable (Variable | str) – The field to be visualized on all meshes
fig (Figure | None) – matplotlib figure to use for plotting
ax (Axes | None) – matplotlib axis to use for plotting
- Keyword Arguments:
cb_labelsize: colorbar labelsize
cb_loc: colorbar location (‘left’ or ‘right’)
cb_pad: colorbar padding
cmap: colormap
dpi: resolution
figsize: figure size
fontsize size for labels and captions
levels: user defined levels
log_scaled: logarithmic scaling
show_edges: show element edges
show_max: mark the location of the maximum value
show_min: mark the location of the minimum value
show_region_bounds: show the edges of the different regions
vmin: minimum value
vmax: maximum value
- Return type:
Figure | None
- plot_quiver(ax, variable, projection=None, glyph_type='arrow')#
Plot arrows or lines corresponding to vectors on a matplotlib axis.
- Parameters:
ax (Axes) – Matplotlib axis to plot onto
variable (Vector) – Vector variable to visualize
projection (int | None) – Index of flat dimension (e.g. 2 for z axis), gets automatically determined if not given
glyph_type (Literal['arrow', 'line']) – Whether to plot arrows or lines.
- plot_streamlines(ax, variable, projection=None)#
Plot the vector streamlines on a matplotlib axis.
- Parameters:
ax (Axes) – Matplotlib axis to plot onto
variable (Vector) – Vector variable to visualize
projection (int | None) – Index of flat dimension (e.g. 2 for z axis), gets automatically determined if not given
- plot_linesample(x, variable, profile_points, ax, resolution=100, grid=None, **kwargs)#
Plot selected variables obtained from sample_over_polyline function, this function calls to it internally. Values provided in param x and y refer to columns of the DataFrame returned by it.
- Parameters:
x (str) – Value to be used on x-axis of the plot
variable (str | Variable) – Values to be used on y-axis of the plot
profile_points (ndarray) – Points defining the profile (and its segments)
ax (Axes) – User-created array of Matplotlib axis object
resolution (int | None) – Resolution of the sampled profile. Total number of points within all profile segments.
resolution – Resolution of the sampled profile. Total number of points within all profile segments.
grid (Literal['major', 'both', None]) – Which gridlines should be drawn?
kwargs (Any) – Optional keyword arguments passed to matplotlib.pyplot.plot to customize plot options like a line label (for auto legends), linewidth, antialiasing, marker face color.
- Returns:
Matplotlib Axes object
- Return type:
Axes
- plot_linesample_contourf(variables, profile_points, resolution=None, plot_nodal_pts=True, nodal_pts_labels=None)#
Default plot for the data obtained from sampling along a profile on a mesh.
- Parameters:
variables (str | list | Variable) – Variables to be read from the mesh
profile_points (ndarray) – Points defining the profile (and its segments)
resolution (int | None) – Resolution of the sampled profile. Total number of points within all profile segments.
plot_nodal_pts (bool | None) – Plot and annotate all nodal points in profile
nodal_pts_labels (str | list | None) – Labels for nodal points (only use if plot_nodal_points is set to True)
- Returns:
Tuple containing Matplotlib Figure and Axis objects
- Return type:
tuple[Figure, Axes]
- __init__(pv_mesh=None, spatial_unit='m', spatial_output_unit='m', **kwargs)[source]#
Initialize a Mesh object
- param pv_mesh:
Underlying pyvista mesh.
- param data_length_unit:
Length unit of the mesh data.
- param output_length_unit:
Length unit in plots.
- classmethod read(filepath, spatial_unit='m', spatial_output_unit='m')[source]#
Initialize a Mesh object
- param filepath:
Path to the mesh or shapefile file.
- param data_length_unit:
Spatial data unit of the mesh.
- param output_length_unit:
Spatial output unit of the mesh.
- returns:
A Mesh object
- Return type:
- classmethod read_shape(simplify=False, mesh_generator='triangle', cellsize=None)#
Generate a pyvista Unstructured grid from a shapefile.
- Parameters:
simplify (bool) – With the Douglas-Peucker algorithm the geometry is simplified. The original line is split into smaller parts. All points with a distance smaller than half the cellsize are removed. Endpoints are preserved. More infos at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.simplify.html.
mesh_generator (str) – Choose between ‘triangle’ and ‘gmsh’ to generate the mesh.
cellsize (int | None) – Size of the cells in the mesh - only needed for simplify algorithm. If None - cellsize is 1/100 of larger bound (x or y).
- Returns:
pv.UnstructuredGrid
- Return type:
UnstructuredGrid
- class ogstools.meshlib.MeshSeries[source]#
Bases:
object
A wrapper around pyvista and meshio for reading of pvd and xdmf timeseries.
Initialize a MeshSeries object
- param filepath:
Path to the PVD or XDMF file.
- param time_unit:
Data unit of the timevalues.
- param data_length_unit:
Length unit of the mesh data.
- param output_length_unit:
Length unit in plots.
- returns:
A MeshSeries object
- __init__(filepath, time_unit='s', spatial_unit='m', spatial_output_unit='m')[source]#
Initialize a MeshSeries object
- param filepath:
Path to the PVD or XDMF file.
- param time_unit:
Data unit of the timevalues.
- param data_length_unit:
Length unit of the mesh data.
- param output_length_unit:
Length unit in plots.
- returns:
A MeshSeries object
- data(variable_name)[source]#
Returns an DataItems object, that allows array indexing. To get “geometry”/”points” or “topology”/”cells” read the first time step and use pyvista functionality Selection example: ms = MeshSeries() temp = ms.data(“temperature”) time_step1_temps = temp[1,:] temps_at_some_points = temp[:,1:3] :param variable_name: Name the variable (e.g.”temperature”) :returns: Returns an objects that allows array indexing.
- Return type:
- aggregate(variable, np_func, axis, mask=None)[source]#
Aggregate data of all timesteps using a specified function.
- Parameters:
variable (Variable | str) – The mesh variable to be aggregated.
func – The aggregation function to apply.
- Returns:
A numpy.ndarray of the same length as the timesteps if axis=0 or of the same length as the data if axis=1.
- Return type:
ndarray
- aggregate_over_time(variable, func)[source]#
Aggregate data over all timesteps using a specified function.
- closest_timestep(timevalue)[source]#
Return the corresponding timestep from a timevalue.
- Return type:
int
- closest_timevalue(timevalue)[source]#
Return the closest timevalue to a timevalue.
- Return type:
float
- mesh(timestep, lazy_eval=True)[source]#
Selects mesh at given timestep all data function.
- Return type:
- rawdata_file()[source]#
Checks, if working with the raw data is possible. For example, OGS Simulation results with XDMF support efficient raw data access via h5py
- Returns:
The location of the file containing the raw data. If it does not support efficient read (e.g., no efficient slicing), it returns None.
- Return type:
Path | None
- read_interp(timevalue, lazy_eval=True)[source]#
Return the temporal interpolated mesh for a given timevalue.
- Return type:
- property timesteps: range#
Return the timesteps of the timeseries data.
- timevalues(time_unit=None)[source]#
Return the timevalues, optionally converted to another time unit.
- Return type:
ndarray
- values(data_name, selection=None)[source]#
Get the data in the MeshSeries for all timesteps.
- Parameters:
data_name (str) – Name of the data in the MeshSeries.
selection (slice | ndarray | None) –
Can limit the data to be read. - Time is always the first dimension. - If None, it takes the selection that is defined in the xdmf file. - If a tuple or np.ndarray: see how h5py uses Numpy array indexing. - If a slice: see Python slice reference. - If a string: see example:
Example:
"|0 0 0:1 1 1:1 190 3:97 190 3"
This represents the selection
[(offset(0,0,0): step(1,1,1) : end(1,190,3) : of_data_with_size(97,190,30))]
.
- Returns:
A numpy array of the requested data for all timesteps.
- Return type:
ndarray
- time_of_min(variable)[source]#
Returns a Mesh with the time of the variable minimum as data.
- Return type:
- time_of_max(variable)[source]#
Returns a Mesh with the time of the variable maximum as data.
- Return type:
- aggregate_over_domain(variable, func, mask=None)[source]#
Aggregate data over domain per timestep using a specified function.
- Parameters:
variable (Variable | str) – The mesh variable to be aggregated.
func (Literal['min', 'max', 'mean', 'median', 'sum', 'std', 'var']) – The aggregation function to apply.
mask (ndarray | None) – A numpy array as a mask for the domain.
- Returns:
A numpy array with aggregated data.
- Return type:
ndarray
- plot_domain_aggregate(variable, func, timesteps=None, time_unit='s', mask=None, ax=None, **kwargs)[source]#
Plot the transient aggregated data over the domain per timestep.
- Parameters:
variable (Variable | str) – The mesh variable to be aggregated.
func (Literal['min', 'max', 'mean', 'median', 'sum', 'std', 'var']) – The aggregation function to apply.
timesteps (slice | None) – A slice to select the timesteps. Default: all.
time_unit (str | None) – Output unit of the timevalues.
mask (ndarray | None) – A numpy array as a mask for the domain.
ax (Axes | None) – matplotlib axis to use for plotting
kwargs (Any) – Keyword args passed to matplotlib’s plot function.
- Returns:
A matplotlib Figure or None if plotting on existing axis.
- Return type:
Figure | None
- probe(points, data_name, interp_method='linear')[source]#
Probe the MeshSeries at observation points.
- Parameters:
points (ndarray) – The observation points to sample at.
data_name (str) – Name of the data to sample.
interp_method (Literal['nearest', 'linear']) – Interpolation method, defaults to linear
- Returns:
numpy array of interpolated data at observation points.
- Return type:
ndarray
- plot_probe(points, variable, variable_abscissa=None, labels=None, time_unit='s', interp_method='linear', colors=None, linestyles=None, ax=None, fill_between=False, **kwargs)[source]#
Plot the transient variable on the observation points in the MeshSeries.
- param points:
The points to sample at.
- param variable:
The variable to be sampled.
- param labels:
The labels for each observation point.
- param time_unit:
Output unit of the timevalues.
- param interp_method:
Choose the interpolation method, defaults to linear for xdmf MeshSeries and probefilter for pvd MeshSeries.
- param interp_backend:
Interpolation backend for PVD MeshSeries.
- param kwargs:
Keyword arguments passed to matplotlib’s plot function.
- returns:
A matplotlib Figure
- Return type:
Figure | None
- animate(variable, timesteps=None, mesh_func=lambda mesh: ..., plot_func=lambda *_: ..., **kwargs)[source]#
Create an animation for a variable with given timesteps.
- Parameters:
variable (Variable) – the field to be visualized on all timesteps
timesteps (Sequence | None) – if sequence of int: the timesteps to animate if sequence of float: the timevalues to animate
mesh_func (Callable[[Mesh], Mesh]) – A function which expects to read a mesh and return a mesh. Useful, for slicing / clipping / thresholding the meshseries for animation.
plot_func (Callable[[Axes, float], None]) – A function which expects to read a matplotlib Axes and the time value of the current frame. Useful to customize the plot in the animation.
- Keyword Arguments:
- Return type:
FuncAnimation
- plot_time_slice(variable, points, y_axis='auto', interpolate=True, time_unit='s', time_logscale=False, fig=None, ax=None, cbar=True, **kwargs)[source]#
- Parameters:
variable (Variable | str) – The variable to be visualized.
points (ndarray) – The points along which the data is sampled over time.
y_axis (Literal['x', 'y', 'z', 'dist', 'auto']) – The component of the sampling points which labels the y-axis. By default, if only one coordinate of the points is changing, this axis is taken, otherwise the distance along the line is taken.
interpolate (bool) – Smoothen the result be interpolation.
time_unit (str) – Time unit displayed on the x-axis.
time_logscale (bool) – Should log-scaling be applied to the time-axis?
fig (Figure | None) – matplotlib figure to use for plotting.
ax (Axes | None) – matplotlib axis to use for plotting.
cb_loc – Colorbar location. If None, omit colorbar.
- Keyword Arguments:
cb_labelsize: colorbar labelsize
cb_loc: colorbar location (‘left’ or ‘right’)
cb_pad: colorbar padding
cmap: colormap
vmin: minimum value for colorbar
vmax: maximum value for colorbar
num_levels: number of levels for colorbar
figsize: figure size
dpi: resolution
- Return type:
Figure
- 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)#
- 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#
- ogstools.meshlib.cuboid(lengths=1.0, n_edge_cells=1, n_layers=1, structured_grid=True, order=1, mixed_elements=False, out_name=Path('unit_cube.msh'), msh_version=None)[source]#
- ogstools.meshlib.difference(base_mesh, subtract_mesh, variable=None)[source]#
Compute the difference of variables between two meshes.
- Parameters:
base_mesh (Mesh) – The mesh to subtract from.
subtract_mesh (Mesh) – The mesh whose data is to be subtracted.
variable (Variable | str | None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Returns:
A new mesh containing the difference of variable or of all datasets between both meshes.
- Return type:
Mesh
- ogstools.meshlib.difference_matrix(meshes_1, meshes_2=None, variable=None)[source]#
Compute the difference between all combinations of two meshes from one or two arrays based on a specified variable.
- Parameters:
meshes_1 (list | ndarray) – The first list/array of meshes to be subtracted from.
meshes_2 (list | ndarray | None) – The second list/array of meshes, it is subtracted from the first list/array of meshes - meshes_1 (optional).
variable (Variable | str | None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Returns:
An array of meshes containing the differences of variable or all datasets between meshes_1 and meshes_2 for all possible combinations.
- Return type:
ndarray
- ogstools.meshlib.difference_pairwise(meshes_1, meshes_2, variable=None)[source]#
Compute pairwise difference between meshes from two lists/arrays (they have to be of the same length).
- Parameters:
meshes_1 (list | ndarray) – The first list/array of meshes to be subtracted from.
meshes_2 (list | ndarray) – The second list/array of meshes whose data is subtracted from the first list/array of meshes - meshes_1.
variable (Variable | str | None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Returns:
An array of meshes containing the differences of variable or all datasets between meshes_1 and meshes_2.
- Return type:
ndarray
- ogstools.meshlib.distance_in_profile(points)[source]#
- Parameters:
points (ndarray) – 2D array of N points (profile nodes) of shape (N, 3)
- Returns:
1D array of distances of each point to the beginning of the profile (first row in points), shape of (N,)
- Return type:
ndarray
- ogstools.meshlib.distance_in_segments(profile_nodes, profile)[source]#
Calculate the distance within segments of a polyline profile.
- Parameters:
profile_nodes (ndarray) – 2D array of N points (profile nodes) of shape (N, 3)
profile (ndarray) – output from interp_points function. 2D array of N points (profile nodes) of shape (N, 3)
- Returns:
1D array of distances in each segment to its starting point of shape (N, 3), where N is the number of points in profile
- Return type:
ndarray
- ogstools.meshlib.interp_points(points, resolution=100)[source]#
Provides lists of points on every segment at a line profile between arbitrary number of points pairs.
- Parameters:
points (ndarray) – Numpy array of N points to sample between. Has to be of shape (N, 3).
resolution (int) – Resolution of the sampled profile. Total number of points within all profile segments.
- Returns:
Numpy array of shape (N, 3), without duplicated nodal points.
- Return type:
ndarray
- ogstools.meshlib.rect(lengths=1.0, n_edge_cells=1, n_layers=1, structured_grid=True, order=1, mixed_elements=False, jiggle=0.0, out_name=Path('rect.msh'), msh_version=None)[source]#
- ogstools.meshlib.sample_polyline(mesh, variables, profile_nodes, resolution=100)[source]#
Sample one or more variables along a polyline. Profiles created by user can be passed as profile_nodes parameter. In this case user should also set resolution to None in order to avoid further interpolation between the points.
- Parameters:
mesh (UnstructuredGrid) – Mesh from which variables will be sampled.
variables (str | Variable | list[str] | list[Variable]) – Name or list of names of variables to sample.
profile_nodes (ndarray) – 2D array of N points (profile nodes) of shape (N, 3)
resolution (int | None) – Total number of sampling points.
- Returns:
tuple containing DataFrame with results of the profile sampling and Numpy array of distances from the beginning of the profile at points defined in profile_points.
- Return type:
tuple[DataFrame, ndarray]
- ogstools.meshlib.to_ip_mesh(mesh)[source]#
Create a mesh with cells centered around integration points.
- Return type:
UnstructuredGrid
- ogstools.meshlib.to_ip_point_cloud(mesh)[source]#
Convert integration point data to a pyvista point cloud.
- Return type:
UnstructuredGrid
- ogstools.meshlib.to_region_prism(layer_set, resolution)[source]#
Convert a layered geological structure into a RegionSet using prism meshing.
This function takes a
boundary_set.LayerSet
and converts it into aregion.RegionSet
object using prism or tetrahedral meshing technique. The function will use prism elements for meshing if possible; otherwise, it will use tetrahedral elements.- Parameters:
layer_set (LayerSet): A
boundary_set.LayerSet
. resolution (float): The desired resolution in [meter] for meshing. It must greater than 0.- Returns:
RegionSet: A
boundary_set.LayerSet
object containing the meshed representation of the geological structure.- Raises:
ValueError: If an error occurs during the meshing process.
- Example:
layer_set = LayerSet(…) resolution = 0.1 region_set = to_region_prism(layer_set, resolution)
- Return type:
- ogstools.meshlib.to_region_simplified(layer_set, xy_resolution, rank)[source]#
Convert a layered geological structure to a simplified meshed region.
This function converts a layered geological structure represented by a LayerSet into a simplified meshed region using the specified xy_resolution and rank.
- Parameters:
(LayerSet) (layer_set) – A LayerSet object representing the layered geological structure.
(float) (xy_resolution) – The desired spatial resolution of the mesh in the XY plane.
(int) (rank) – The rank of the mesh (2 for 2D, 3 for 3D).
- Return type:
- Returns:
RegionSet: A RegionSet object containing the simplified meshed representation of the geological structure.
- Raises:
AssertionError: If the length of the bounds retrieved from the layer_set is not 6.
- Example:
layer_set = LayerSet(…) xy_resolution = 0.1 # Example resolution in XY plane rank = 2 # Mesh will be 2D region_set = to_region_simplified(layer_set, xy_resolution, rank)
- ogstools.meshlib.to_region_voxel(layer_set, resolution)[source]#
Convert a layered geological structure to a voxelized mesh.
This function converts a layered geological structure represented by a LayerSet into a voxelized mesh using the specified resolution.
- Parameters:
layer_set (LayerSet): A LayerSet object representing the layered geological structure. resolution (list): A list of [x_resolution, y_resolution, z_resolution] for voxelization.
- Returns:
Mesh: A Mesh object containing the voxelized mesh representation of the geological structure.
- Raises:
ValueError: If an error occurs during the voxelization process.
- Example:
layer_set = LayerSet(…) resolution = [0.1, 0.1, 0.1] # Example voxelization resolutions in x, y, and z dimensions voxel_mesh = to_region_voxel(layer_set, resolution)
- Return type:
- ogstools.meshlib.read_shape(shapefile, simplify=False, mesh_generator='triangle', cellsize=None)[source]#
Generate a pyvista Unstructured grid from a shapefile.
- Parameters:
shapefile (str | Path) – Shapefile to be meshed.
simplify (bool) – With the Douglas-Peucker algorithm the geometry is simplified. The original line is split into smaller parts. All points with a distance smaller than half the cellsize are removed. Endpoints are preserved. More infos at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.simplify.html.
mesh_generator (str) – Choose between ‘triangle’ and ‘gmsh’ to generate the mesh.
cellsize (int | None) – Size of the cells in the mesh - only needed for simplify algorithm. If None - cellsize is 1/100 of larger bound (x or y).
- Returns:
pv.UnstructuredGrid
- Return type:
UnstructuredGrid
Subpackages#
Submodules#
- ogstools.meshlib.boundary module
- ogstools.meshlib.boundary_set module
- ogstools.meshlib.boundary_subset module
- ogstools.meshlib.data_processing module
- ogstools.meshlib.geo module
- ogstools.meshlib.gmsh_meshing module
- ogstools.meshlib.ip_mesh module
- ogstools.meshlib.mesh module
- ogstools.meshlib.mesh_series module
PVDDataItems
MeshSeries
MeshSeries.__init__()
MeshSeries.__getitem__()
MeshSeries.data()
MeshSeries.aggregate()
MeshSeries.aggregate_over_time()
MeshSeries.clear()
MeshSeries.closest_timestep()
MeshSeries.closest_timevalue()
MeshSeries.ip_tesselated()
MeshSeries.mesh()
MeshSeries.rawdata_file()
MeshSeries.read_interp()
MeshSeries.timesteps
MeshSeries.timevalues()
MeshSeries.values()
MeshSeries.time_of_min()
MeshSeries.time_of_max()
MeshSeries.aggregate_over_domain()
MeshSeries.plot_domain_aggregate()
MeshSeries.probe()
MeshSeries.plot_probe()
MeshSeries.animate()
MeshSeries.plot_time_slice()
- ogstools.meshlib.refine_mesh module
- ogstools.meshlib.shape_meshing module
- ogstools.meshlib.shp2msh_cli module
- ogstools.meshlib.xdmf_reader module