LoopStructural

repository·master·Indexed 43 days ago

https://github.com/loop3d/loopstructural

An open-source Python library for 3D implicit geological modelling, version 1.8.1. It enables the modelling of fault networks, folds, and other structural elements using interpolation algorithms such as Finite Difference, Piecewise Linear, and RBF. The ecosystem includes Map2Loop for generating model inputs from geological maps and loopstructuralvisualisation for 3D visualization via PyVista.

Tokens
69.5K
Snippets
235
Records
308
Agent score
55%

What's inside LoopStructural

  1. Overview of loop-interpolation utilities

    master

    The loop-interpolation package provides core interpolation utilities used throughout the LoopStructural workspace. It includes several types of interpolators for geological modelling:

    • Discrete Interpolators: Supports piecewise linear (P1) and piecewise quadratic (P2) interpolation.
    • Finite Difference Interpolators: Used for calculating derivatives or working with grid-based data.
    • Fold Interpolator: A specialized interpolator used across various LoopStructural workspace packages.
  2. Overview of loop-common

    master

    The loop-common package provides shared utilities used across the LoopStructural workspace. It is primarily used for handling geometry, data structures, and mathematical operations required by other LoopStructural packages.

    Key capabilities include:

    • Bounding box geometry helpers: Utilities for managing and calculating spatial bounds.
    • Mesh and grid support types: Shared type definitions and structures for handling meshes and grids.
    • Shared math and logging utilities: Common mathematical functions and standardized logging implementations used throughout the ecosystem.
  3. Understand the LoopStructural 2.0 Roadmap and Architecture

    master

    LoopStructural 2.0 is a staged rebuild of the modelling core. The project is transitioning towards a graph-based backend for model storage while maintaining the existing GeologicalModel API for evaluation.

    Key architectural changes include:

    • Model Definition: Moving towards a YAML/JSON format that captures parameter choices and data references.
    • Decoupled Interpolation: Extracting interpolation code to be usable independently of the LoopStructural framework.
    • Workspace Integration: loopresources and map2loop are integrated as uv-workspace packages within this repository due to their tight coupling with LoopStructural inputs.
    • QGIS Plugin: The QGIS plugin remains in a separate repository and acts as a consumer of published LoopStructural releases to maintain independent release cadences.
  4. Advanced use cases in LoopStructural

    master

    LoopStructural supports advanced geological modelling workflows including:

    • Direct Model Building: Constructing models directly from raw geological map data using the ProcessInputData class.
    • Observability: Inspecting internal processes and model construction steps via LoopStructural's logging output.
    • Constraint Control: Adjusting how strongly individual data points constrain the interpolation process.
    • Method Comparison: Comparing LoopStructural's mesh-based interpolators against standard scattered-data interpolation methods.
  5. Overview of LoopStructural implicit surface modelling

    master

    LoopStructural is a 3D geological modelling library designed for the Loop ecosystem. It provides implicit surface modelling capabilities using three primary interpolation approaches:

    • Piecewise Linear Interpolation: Performed on a tetrahedral mesh, this algorithm minimises the second derivative of the implicit function between neighbouring tetrahedra. It is based on discrete smooth interpolation research (Frank et al., 2007; Caumon et al., 2007).
    • Cartesian Grid Interpolation: A variation of the piecewise linear framework that minimises second derivatives using finite differences on a regular Cartesian grid.
    • Folded Surface Modelling: An extension of the Piecewise Linear framework that incorporates structural frames (characterising axial foliation and fold axes). It modifies regularisation constraints to occur only orthogonal to the fold axis and axial surface, allowing for the modelling of complex folded geometries.
  6. What is implicit geological modelling?

    master

    Implicit geological modelling represents geological objects using a mathematical function $f(x,y,z)$ where the function returns the distance to the geological feature. The geometry is approximated by using observations of the location and shape of the objects.

    In LoopStructural, you can constrain this function using:

    • Value constraints: Specifying the value of the function at specific locations (e.g., $f(x,y,z) = 0$ at a fault trace).
    • Normal (Gradient) constraints: Specifying the orientation (strike/dip) and the gradient norm (how quickly the value changes) to further constrain the geometry.
  7. What is LoopStructural and how does it model geology?

    master

    LoopStructural is an open-source Python 3.9+ library for 3D implicit geological modelling. In this framework, geological objects are represented by an implicit function that typically represents the distance or pseudodistance to a reference horizon.

    Because there is no single analytical function for all geological geometries, LoopStructural approximates the implicit function using surface observations:

    • Location: The position of a geological feature defines the value of the implicit function at that location.
    • Orientation: The orientation (e.g., strike and dip) of a surface constrains the gradient of the implicit function.

    To model complex features, additional constraints are used:

    • Folds: Overprinting relationships are incorporated via specific fold constraints.
    • Faults: Requires known fault displacement and fault slip direction vectors.
    • Unconformities: Incorporated by specifying the value of an existing implicit function that defines the unconformity surface.
  8. Understand the core LoopStructural workflow

    master

    The standard workflow in LoopStructural follows these steps:

    1. Data Preparation: Convert a table of X, Y, and Z observations into a GeologicalModel object.
    2. Surface Building: Build implicit surfaces from the observation data.
    3. Structural Integration: Combine multiple stratigraphic groups, accounting for unconformities and faults.
    4. Output: Visualise the resulting model and export the data.

    This basic workflow serves as the foundation for more advanced examples in the repository.

  9. How interpolators work in LoopStructural

    master

    Interpolators in LoopStructural are used to construct 2D or 3D scalar fields from geological constraints (such as contacts, folds, or orientations).

    All interpolators must inherit from the GeologicalInterpolator base class. This class serves as the entry point for all interpolation logic and provides methods for accessing constraints. The interpolation module also includes supporting structures such as meshes, grids, and operators.

  10. Understand BoundingBox coordinate systems

    master

    In recent versions, the BoundingBox API has been unified with loop_common.

    • Coordinates: origin and maximum are always expressed in world coordinates.
    • Local Frame: To define a near-zero interpolation frame, use set_local_transform(local_origin=...).
    • Projection: The responsibility for converting between world and local frames has moved to the interpolator/support layer. GeologicalInterpolator.bounding_box handles projecting constraint or query points via project, reproject, project_vectors, or reproject_vectors.
  11. Versioning and Backward Compatibility Policy

    master

    LoopStructural follows strict Semantic Versioning (SemVer).

    Compatibility Rules:

    • 1.x Releases: Guaranteed to be backward compatible. Any module-path moves or renames (e.g., moving datatypes to geometry) must include a re-export shim with a DeprecationWarning. These shims must be maintained for at least two minor releases.
    • 2.0 Major Release: The transition to the graph-backend is the only planned breaking change. This will be supported by a GeologicalModel compatibility facade to ensure existing scripts continue to function.

    Release Tracks:

    • Routine Track: Bug fixes and additive features are released via automation on the master branch.
    • Stage-release Track: Major roadmap stages are released as vX.Y.0rc1 (Release Candidates). These undergo a minimum 1-week soak window and must pass the example gallery headless tests and QGIS-plugin compatibility CI before being promoted to stable.
  12. How GeologicalModels and GeologicalFeatures interact

    master

    The core of a LoopStructural workflow involves the relationship between a model and its features:

    • GeologicalModel: The top-level container for the entire geological environment.
    • GeologicalFeature: Represents a specific geological phenomenon (e.g., a stratigraphic sequence, fault, foliation, unconformity, or intrusion). Features can be evaluated for specific values or gradients.
    • GeologicalFeatureBuilder: The mechanism used to create a GeologicalFeature. The builder manages the assembly of interpolation constraints and monitors whether the underlying data or constraints have changed to determine if the interpolator needs to be re-executed.