ogstools.meshlib.data_processing module#
- ogstools.meshlib.data_processing.difference(mesh1, mesh2, mesh_property=None)[source]#
Compute the difference of properties between two meshes.
- Parameters:
mesh1 (UnstructuredGrid) – The first mesh to be subtracted from.
mesh2 (UnstructuredGrid) – The second mesh whose data is subtracted from the first mesh.
mesh_property (Property | str | None) – The property of interest. If not given, all point and cell_data will be processed raw.
- Returns:
A new mesh containing the difference of mesh_property or all datasets between mesh1 and mesh2.
- Return type:
UnstructuredGrid
- ogstools.meshlib.data_processing.difference_pairwise(meshes_1, meshes_2, mesh_property=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.
mesh_property (Property | str | None) – The property of interest. If not given, all point and cell_data will be processed raw.
- Returns:
An array of meshes containing the differences of mesh_property or all datasets between meshes_1 and meshes_2.
- Return type:
ndarray
- ogstools.meshlib.data_processing.difference_matrix(meshes_1, meshes_2=None, mesh_property=None)[source]#
Compute the difference between all combinations of two meshes from one or two arrays based on a specified property.
- 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).
mesh_property (Property | str | None) – The property of interest. If not given, all point and cell_data will be processed raw.
- Returns:
An array of meshes containing the differences of mesh_property or all datasets between meshes_1 and meshes_2 for all possible combinations.
- Return type:
ndarray
- ogstools.meshlib.data_processing.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.data_processing.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.data_processing.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.data_processing.sample_polyline(mesh, properties, profile_nodes, resolution=100)[source]#
Sample one or more properties 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 properties will be sampled.
properties (str | Property | list) – Name or list of names of properties to sample. :param profile_nodes: 2D array of N points (profile nodes) of shape (N, 3)
resolution (int | None) – Total number of sampling points.
profile_nodes (ndarray)
- 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, array]