Skip to content

Commit be33a6f

Browse files
committed
docs: 📝 updating docs for pydata, actually committing changes
1 parent c5b28d5 commit be33a6f

File tree

9 files changed

+93
-91
lines changed

9 files changed

+93
-91
lines changed

LoopStructural/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import logging
88
from logging.config import dictConfig
9+
__all__ = ['GeologicalModel']
910
import tempfile
1011
from pathlib import Path
1112
from .version import __version__

LoopStructural/interpolators/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Interpolators and interpolation supports
33
44
"""
5+
__all__ = ['InterpolatorType','GeologicalInterpolator','DiscreteInterpolator','FiniteDifferenceInterpolator','PiecewiseLinearInterpolator','DiscreteFoldInterpolator','SurfeRBFInterpolator','P1Interpolator','P2Interpolator','TetMesh',
6+
'StructuredGrid',
7+
'UnStructuredTetMesh',
8+
'P1Unstructured2d',
9+
'P2Unstructured2d',
10+
'StructuredGrid2D',
11+
'P2UnstructuredTetMesh',]
512
from enum import IntEnum
613

714
from LoopStructural.utils import getLogger

LoopStructural/modelling/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Geological modelling classes and functions
33
44
"""
5+
__all__ = ['GeologicalModel', 'ProcessInputData', 'LavaVuModelViewer', 'Map2LoopProcessor','LoopProjectfileProcessor','StructuralFrame','FaultSegment']
56
from LoopStructural.utils import getLogger
67
from LoopStructural.utils import LoopImportError
78

LoopStructural/modelling/core/geological_model.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,6 @@ def from_map2loop_directory(
272272
model = GeologicalModel.from_processor(processor)
273273
return model, processor
274274

275-
# from LoopStructural.utils import build_model, process_map2loop
276-
# logger.info('LoopStructural model initialised from m2l directory: {}'.format(m2l_directory))
277-
# m2lflags = kwargs.pop('m2lflags',{})
278-
# m2l_data = process_map2loop(m2l_directory,m2lflags)
279-
# return build_model(m2l_data,**kwargs), m2l_data
280-
281275
@classmethod
282276
def from_processor(cls, processor):
283277
logger.info("Creating model from processor")

docs/source/conf.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
napoleon_numpy_docstring = True #False # Force consistency, leave only Google
4040
napoleon_use_rtype = False # More legible
4141
autosummary_imported_members = True
42-
42+
autosummary_ignore_module_all = False
4343
# Add any Sphinx extension module names here, as strings. They can be
4444
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4545
# ones.
@@ -65,13 +65,31 @@
6565
# This pattern also affects html_static_path and html_extra_path.
6666
exclude_patterns = []
6767

68-
68+
html_theme_options = {
69+
"icon_links": [
70+
{
71+
"name": "GitHub",
72+
"url": "https://github.com/loop3d/LoopStructural",
73+
"icon": "fab fa-github-square",
74+
},
75+
{
76+
"name": "Twitter",
77+
"url": "https://twitter.com/loop3d",
78+
"icon": "fab fa-twitter-square",
79+
},
80+
],
81+
# "navbar_start": ["navbar-logo", "navbar-version"],
82+
# "use_edit_page_button": True,
83+
"external_links": [
84+
{"name": "Loop3d", "url": "https://www.loop3d.org"},
85+
],
86+
}
6987
# -- Options for HTML output -------------------------------------------------
7088

7189
# The theme to use for HTML and HTML Help pages. See the documentation for
7290
# a list of builtin themes.
7391
#
74-
html_theme = 'sphinx_rtd_theme'
92+
html_theme = 'pydata_sphinx_theme'
7593

7694
# Add any paths that contain custom static files (such as style sheets) here,
7795
# relative to this directory. They are copied after the builtin static files,

docs/source/getting_started.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Getting Started
2+
===============
3+
4+
.. toctree::
5+
:caption: Getting Started
6+
7+
installation
8+
background
9+
auto_examples/index
10+
contributors_guide
11+
about
12+
CHANGELOG

docs/source/index.rst

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,15 @@ and a wrapper for the generalised radial basis functions provided by Surfe :cite
2828
.. toctree::
2929
:hidden:
3030

31-
self
32-
33-
34-
.. toctree::
35-
:caption: Getting Started
36-
:hidden:
37-
38-
installation
39-
background
31+
getting_started
4032
auto_examples/index
41-
contributors_guide
42-
about
43-
CHANGELOG
44-
45-
.. toctree::
46-
:caption: User Guide:
47-
:hidden:
33+
user_guide/index
4834

49-
user_guide/input_data
50-
user_guide/geological_model
51-
user_guide/interpolation_options
52-
user_guide/fold_modelling
53-
user_guide/fault_modelling
54-
user_guide/visualisation
55-
56-
.. toctree::
35+
36+
.. toctree::
5737
:caption: LoopStructural API
5838
:hidden:
5939

60-
6140
.. autosummary::
6241
:caption: API
6342
:toctree: _autosummary
@@ -67,13 +46,3 @@ and a wrapper for the generalised radial basis functions provided by Surfe :cite
6746
LoopStructural
6847

6948

70-
.. .. toctree::
71-
:caption: Loop
72-
73-
74-
.. map2loop
75-
geophysics
76-
uncertainty
77-
78-
.. bibliography:: references.bib
79-
:style:

docs/source/user_guide/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
User Guide
2+
===========
13

4+
.. toctree::
5+
:caption: User Guide
6+
7+
input_data
8+
geological_model
9+
interpolation_options
10+
fold_modelling
11+
fault_modelling
12+
visualisation

examples/3_fault/plot_fault_network.py

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,46 @@
11
"""
2-
============================================
3-
Modelling a fault network in LoopStructural
4-
5-
============================================
2+
3b. Modelling a fault network in LoopStructural
3+
===============================================
64
Uses GeologicalModel, ProcessInputData and LavaVuModelViewer from LoopStructural library. Also using geopandas to read a shapefile, pandas, matplotlib and numpy."""
75

86
import LoopStructural
97
LoopStructural.__version__
8+
109
from LoopStructural import GeologicalModel
1110
from LoopStructural.modelling import ProcessInputData
1211
from LoopStructural.visualisation import LavaVuModelViewer
1312
import geopandas
1413
import pandas as pd
1514
import matplotlib.pyplot as plt
1615
import numpy as np
17-
# ~~~~~~~~~~~~~~~
16+
17+
##############################
1818
# Read shapefile
19-
20-
# ~~~~~~~~~~~~~~~
21-
#
22-
# Read the shapefile and create a point for each node of the line
23-
#
24-
# | **fault_name** | **X** | **Y** | **Z**|
25-
# | --------------- |-----| ------| -------|
26-
# | ... | . | . | .
19+
# ~~~~~~~~~~~~~~
20+
# # Read the shapefile and create a point for each node of the line # # | **fault_name** | **X** | **Y** | **Z**| # | --------------- |-----| ------| -------|# | ... | . | . | .
21+
2722
fault_trace = geopandas.read_file('fault_trace.shp')
23+
2824
faults = []
2925
for i in range(len(fault_trace)):
3026
for x,y in zip(fault_trace.loc[i,:].geometry.xy[0],fault_trace.loc[i,:].geometry.xy[1]):
3127
faults.append([fault_trace.loc[i,'fault_name'], x,y,np.random.random()*.4]) # better results if points aren't from a single plane
3228
df = pd.DataFrame(faults,columns=['fault_name','X','Y','Z'])
29+
3330
fig, ax = plt.subplots()
3431
ax.scatter(df['X'],df['Y'])
3532
ax.axis('square')
33+
3634
scale = np.min([df['X'].max()-df['X'].min(),df['Y'].max()-df['Y'].min()])
3735
df['X']/=scale
3836
df['Y']/=scale
3937

40-
# ~~~~~~~~~~~~~~~~~
38+
39+
##############################
4140
# Orientation data
42-
43-
# ~~~~~~~~~~~~~~~~~
41+
# ~~~~~~~~~~~~~~~~
4442
# We can generate vertical dip data at the centre of the fault.
43+
4544
ori = []
4645
for f in df['fault_name'].unique():
4746
centre = df.loc[df['fault_name']==f,['X','Y','Z']].mean().to_numpy().tolist()
@@ -51,69 +50,59 @@
5150
ori.append([f,*centre,*norm])#.extend(centre.extend(norm.tolist())))
5251
# fault_orientations = pd.DataFrame([[
5352
ori = pd.DataFrame(ori,columns=['fault_name','X','Y','Z','gx','gy','gz'])
54-
# ~~~~~~~~~~~~~
53+
54+
##############################
5555
# Model extent
56-
57-
# ~~~~~~~~~~~~~
58-
#
59-
# Calculate the bounding box for the model using the extent of the shapefiles. We make the Z coordinate 10% of the maximum x/y length.
56+
# ~~~~~~~~~~~~
57+
# # Calculate the bounding box for the model using the extent of the shapefiles. We make the Z coordinate 10% of the maximum x/y length.
58+
6059
z = np.max([df['X'].max(),df['Y'].max()])- np.min([df['X'].min(),df['Y'].min()])
6160
z*=.2
6261
origin = [df['X'].min()-z,df['Y'].min()-z,-z]
6362
maximum = [df['X'].max()+z,df['Y'].max()+z,z]
64-
# ~~~~~~~~~~~~~~~~~~~~
63+
64+
##############################
6565
# Setting up the data
66-
67-
# ~~~~~~~~~~~~~~~~~~~~
68-
# The `ProcessInputData` class is used to convert common geological map components to the datastructures required by LoopStructural.
69-
#
70-
# To build a fault network we need to provide:
71-
# * fault locations - a table of x,y,z, and the fault name
72-
# * fault orientations - a table recording the orientation observations of the fault, e.g. strike, dip or normal vector and x,y,z, fault_name
73-
# * origin - the origin of the model bounding box
74-
# * maximum - the maximum extend of the model bounding box
75-
# * fault_edges - list of intersection relationships between faults e.g. [('fault1','fault2')] indicates that there is a intersection between fault1 and fault2
76-
# * fault_edge_properties - list of properties for the fault edges - this can be the type of intersection e.g. 'splay' or 'abut' or just the angle between the faults
77-
# * fault_properties (*optional*) - a pandas dataframe with any kwargs for the interpolator where the index is the fault name
78-
#
79-
# Below is an example of setting the number of interpolation elements for each fault
80-
# ```Python
81-
# fault_properties = pd.DataFrame([['fault_1',1e4],
82-
# ['fault_2',1e4]],
83-
# columns=['fault_name','nelements']).set_index('fault_name')
84-
# ```
85-
# ~~~~~~~~~~~~~~~~~~~~~~~
66+
# ~~~~~~~~~~~~~~~~~~~
67+
# The `ProcessInputData` class is used to convert common geological map components to the datastructures required by LoopStructural.# # To build a fault network we need to provide:# * fault locations - a table of x,y,z, and the fault name# * fault orientations - a table recording the orientation observations of the fault, e.g. strike, dip or normal vector and x,y,z, fault_name# * origin - the origin of the model bounding box# * maximum - the maximum extend of the model bounding box# * fault_edges - list of intersection relationships between faults e.g. [('fault1','fault2')] indicates that there is a intersection between fault1 and fault2# * fault_edge_properties - list of properties for the fault edges - this can be the type of intersection e.g. 'splay' or 'abut' or just the angle between the faults# * fault_properties (*optional*) - a pandas dataframe with any kwargs for the interpolator where the index is the fault name # # Below is an example of setting the number of interpolation elements for each fault# ```Python# fault_properties = pd.DataFrame([['fault_1',1e4],# ['fault_2',1e4]],# columns=['fault_name','nelements']).set_index('fault_name')# ```
68+
69+
##############################
8670
# Modelling splay faults
87-
88-
# ~~~~~~~~~~~~~~~~~~~~~~~
71+
# ~~~~~~~~~~~~~~~~~~~~~~
8972
# A splay fault relationship is defined for any fault where the angle between the faults is less than $30^\circ$. In this example we specify the angle between the faults as $10^\circ$.
73+
9074
processor = ProcessInputData(fault_orientations=ori,
9175
fault_locations=df,
9276
origin=origin,
9377
maximum=maximum,
9478
fault_edges=[('fault_2','fault_1')],
9579
fault_edge_properties=[{'angle':10}],
9680
)
81+
9782
model = GeologicalModel.from_processor(processor)
9883
model.update()
84+
9985
view = LavaVuModelViewer(model)
10086
for f in model.faults:
10187
view.add_isosurface(f,slices=[0])#
10288
view.rotation = [-50.92916488647461, -30.319700241088867, -20.521053314208984]
10389
view.display()
104-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
91+
##############################
10592
# Modelling abutting faults
106-
107-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
93+
# ~~~~~~~~~~~~~~~~~~~~~~~~~
10894
# In this exampe we will use the same faults but specify the angle between the faults as $40^\circ$ which will change the fault relationship to be abutting rather than splay.
95+
10996
processor = ProcessInputData(fault_orientations=ori,
11097
fault_locations=df,
11198
origin=origin,
11299
maximum=maximum,
113100
fault_edges=[('fault_2','fault_1')],
114101
fault_edge_properties=[{'angle':40}],
115102
)
103+
116104
model = GeologicalModel.from_processor(processor)
105+
117106
view = LavaVuModelViewer(model)
118107
for f in model.faults:
119108
view.add_isosurface(f,slices=[0])#

0 commit comments

Comments
 (0)