1j. Exporting models#

Models can be exported to vtk, gocad and geoh5 formats.

from LoopStructural import GeologicalModel
from LoopStructural.datasets import load_claudius

data, bb = load_claudius()

model = GeologicalModel(bb[0, :], bb[1, :])
model.data = data
model.create_and_add_foliation("strati")
-----------------------------------------------------
strati 1
-----------------------------------------------------
    0 regions
    0 faults.
    Fault enabled True

Export surfaces to vtk#

Isosurfaces can be extracted from a geological feature by calling the .surfaces method on the feature. The argument for this method is the value, values or number of surfaces that are extracted. This returns a list of LoopStructural.datatypes.Surface objects These objects can be interrogated to return the triangles, vertices and normals. Or can be exported into another format using the save method. The supported file formats are vtk, ts and geoh5.

surfaces = model['strati'].surfaces(value=0.0)

print(surfaces)

print(surfaces[0].vtk)

# surfaces[0].save('text.geoh5')
[Surface(vertices=array([[ 548800.        , 7816600.        ,   -8890.0935173 ],
       [ 548875.51020408, 7816600.        ,   -8884.0983367 ],
       [ 548800.        , 7816710.20408163,   -8889.89708662],
       ...,
       [ 552500.        , 7821779.59183673,   -8825.66031218],
       [ 552500.        , 7821889.79591837,   -8815.85267544],
       [ 552500.        , 7822000.        ,   -8806.62624121]]), triangles=array([[   2,    1,    0],
       [   2,    3,    1],
       [   4,    3,    2],
       ...,
       [2681, 2740, 2739],
       [2682, 2740, 2681],
       [2682, 2741, 2740]], dtype=int32), normals=array([[-0.05464138, -0.00181299,  0.9985044 ],
       [-0.05544513, -0.01615995,  0.99833095],
       [-0.06904541, -0.00175956,  0.99761194],
       ...,
       [-0.03647267, -0.08397566,  0.9958001 ],
       [-0.03921535, -0.08051164,  0.99598193],
       [-0.04905119, -0.06791639,  0.9964845 ]], dtype=float32), name='strati_0.0', values=array([0., 0., 0., ..., 0., 0., 0.]), properties=None, cell_properties=None)]
<bound method Surface.vtk of Surface(vertices=array([[ 548800.        , 7816600.        ,   -8890.0935173 ],
       [ 548875.51020408, 7816600.        ,   -8884.0983367 ],
       [ 548800.        , 7816710.20408163,   -8889.89708662],
       ...,
       [ 552500.        , 7821779.59183673,   -8825.66031218],
       [ 552500.        , 7821889.79591837,   -8815.85267544],
       [ 552500.        , 7822000.        ,   -8806.62624121]]), triangles=array([[   2,    1,    0],
       [   2,    3,    1],
       [   4,    3,    2],
       ...,
       [2681, 2740, 2739],
       [2682, 2740, 2681],
       [2682, 2741, 2740]], dtype=int32), normals=array([[-0.05464138, -0.00181299,  0.9985044 ],
       [-0.05544513, -0.01615995,  0.99833095],
       [-0.06904541, -0.00175956,  0.99761194],
       ...,
       [-0.03647267, -0.08397566,  0.9958001 ],
       [-0.03921535, -0.08051164,  0.99598193],
       [-0.04905119, -0.06791639,  0.9964845 ]], dtype=float32), name='strati_0.0', values=array([0., 0., 0., ..., 0., 0., 0.]), properties=None, cell_properties=None)>

Export the model to geoh5#

The entire model can be exported to a geoh5 file using the save_model method. This will save all the data, foliations, faults and other objects in the model to a geoh5 file. This file can be loaded into LoopStructural

# model.save('model.geoh5')

Total running time of the script: (0 minutes 0.200 seconds)

Gallery generated by Sphinx-Gallery