Export fracture network data

Export fracture network data#

This notebook will show how to export data from FracAbility as csv or shp. The path argument in both save functions indicates the directory in which the output will be saved. If the directory does not exisit, it will be created. Inside the specified directory the following structure will be created:

Directory
└── output
    ├── csv
       └── all csv files
    └── shp
        ├── qgis_style
           └── Nodes and Boundary qgis style file
        └── All shp files
[1]:
from fracability.examples import data  # import the path of the sample data
from fracability import Entities
[2]:
pontrelli_data = data.Pontrelli()
data_dict = pontrelli_data.data_dict  # Get dict of paths for the data

# Create the fractures and boundary objects.
# Create the fractures and boundary objects.
set_a = Entities.Fractures(shp=data_dict['Set_a.shp'], set_n=1)  # to add your data put the absolute path of the shp file
set_b = Entities.Fractures(shp=data_dict['Set_b.shp'], set_n=2)
set_c = Entities.Fractures(shp=data_dict['Set_c.shp'], set_n=3)

boundary = Entities.Boundary(shp=data_dict['Interpretation_boundary.shp'], group_n=1)


[3]:
path_entities = 'Test_entities'


boundary.save_shp(path=path_entities)
boundary.save_csv(path=path_entities)
set_a.save_shp(path=path_entities)
set_a.save_csv(path=path_entities)
set_b.save_shp(path=path_entities)
set_b.save_csv(path=path_entities)
set_c.save_shp(path=path_entities)
set_c.save_csv(path=path_entities)

Also the fracture network entity can be exported

[4]:
fracture_net = Entities.FractureNetwork()

fracture_net.add_fractures(set_a)
fracture_net.add_fractures(set_b)
fracture_net.add_fractures(set_c)
fracture_net.add_boundaries(boundary)

fracture_net.calculate_topology()



Calculating intersections on fracture: 4272/4272

Invalid point for lines: [439 255 503]

sets: [1 2 3],

The node will be classified accordingly to the number of intersection however, the intersection must be checked!
[5]:
path_fn = 'Test_FN'


fracture_net.save_shp(path=path_fn)
fracture_net.save_csv(path=path_fn)

[6]:
fracture_net.fractures.entity_df
[6]:
id Fault Set dir geometry og_line_id type censored f_set length Type b_group
0 None 1.0 1.0 123.16300 LINESTRING (636960.853 4518526.132, 636960.853... 1 fracture 1 1 4.8394 NaN -9999
1 None 1.0 1.0 123.73829 LINESTRING (636964.885 4518523.498, 636964.905... 2 fracture 0 1 2.4826 NaN -9999
2 None 1.0 1.0 127.62043 LINESTRING (636966.863 4518522.211, 636966.965... 3 fracture 1 1 7.7849 NaN -9999
3 None 1.0 1.0 124.38020 LINESTRING (636962.413 4518528.099, 636962.681... 4 fracture 1 1 6.5703 NaN -9999
4 None 1.0 1.0 124.37587 LINESTRING (636962.398 4518525.605, 636963.005... 5 fracture 0 1 1.6035 NaN -9999
... ... ... ... ... ... ... ... ... ... ... ... ...
4263 NaN 1.0 3.0 NaN LINESTRING (637061.651 4518520.293, 637062.399... 803 fracture 0 3 6.2657 NaN -9999
4264 NaN 1.0 3.0 NaN LINESTRING (637065.055 4518522.517, 637065.659... 804 fracture 0 3 6.3775 NaN -9999
4265 NaN 1.0 3.0 NaN LINESTRING (637053.284 4518519.049, 637053.410... 805 fracture 0 3 1.9063 NaN -9999
4266 NaN 1.0 3.0 NaN LINESTRING (637045.559 4518531.556, 637046.073... 806 fracture 0 3 6.8668 NaN -9999
4267 NaN 1.0 3.0 NaN LINESTRING (637040.327 4518518.176, 637041.109... 807 fracture 0 3 6.7299 NaN -9999

4268 rows × 12 columns

[ ]: