Skip to content

Commit e8079b9

Browse files
committed
Last formal updates before new release
1 parent e2a45ff commit e8079b9

File tree

7 files changed

+48
-15
lines changed

7 files changed

+48
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The following publications have been produced as part of the Parametric Rock Mas
1717

1818

1919
## Supplementary data
20-
Due to size limitations on Github, large data has to be moved to other repositories. Exemplary sample data from PDD1 sample with ID 151763271961 can be found in the folder 'sample_data'. Two external datasets are currently connected to the repository:
20+
Due to size limitations on Github, large data has to be moved to other repositories. Exemplary sample data from PDD1 sample with ID 151763271961 can be found in the folder `sample_data`. Two external datasets are currently connected to the repository:
2121

2222
- The original **Parametric Discontinuity Dataset 1 (PDD1)**: the dataset was created as part of Erharter (2024). It consists of 5000 meshes that comprise synthetic rock mass models in the form of 10 x 10 x 10 m cubes with discontinuities. It can be found on *Zenodo* under this link: https://doi.org/10.5281/zenodo.15835130
2323
- The **raster models of PDD1** that were created as part of Erharter and Elmo (2025). All 5000 models of PDD1 were rastered at resolutions of 0.25, 0.2, 0.15, 0.1 and 0.05 m. Total = 25 000 rasters. The dataset can be found on *Zenodo* under this link: https://doi.org/10.5281/zenodo.15570244

src/A_compiler.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@
77
88
Script that compiles the recorded data from samples of the discrete
99
discontinuity networks and creates one excel file for further processing.
10+
11+
NOTE: this script goes back to the creation of the original PDD1. It was
12+
necessary to compile a single dataset of the mesh models and further metadata
13+
that was saved in Grasshopper. The mesh files are now all in Zenodo
14+
repositories and the Grasshopper Metadata in a zipped folder in this repo. This
15+
script consequently won't work in the current form.
16+
In future versions it will be removed.
17+
-> IF YOU WANT TO COMPILE PDD1 FROM SCRATCH, IT IS BEST TO DO THIS FROM THE
18+
2023 RELEASE OF THE REPOSITORY
19+
https://github.com/geograz/Parametric_Rockmass_Studies/releases/tag/v1.0.0
1020
"""
1121

22+
from os import listdir
23+
import pickle
24+
1225
import gzip
1326
import numpy as np
14-
from os import listdir
1527
import pandas as pd
16-
import pickle
1728
from tqdm import tqdm
1829

1930

src/B_analyzer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
dataset, computes new parameters and creates figures to visualize the dataset.
1010
"""
1111

12+
import pickle
13+
1214
import gzip
1315
import numpy as np
1416
import pandas as pd
15-
import pickle
1617
from skimage.measure import euler_number
1718
from tqdm import tqdm
1819

src/C_rasterizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
for further analyses. Does not include raster analyses - only generation.
1010
"""
1111

12+
from os import listdir
13+
1214
import gzip
1315
import pickle
1416
import gc
1517
import numpy as np
1618
import pandas as pd
1719
import trimesh
18-
from os import listdir
1920

2021
from X_library import parameters, utilities
2122

src/D_Voxel_export.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@
88
Script that saves a mesh of a rastered sample. For visualization purposes only.
99
"""
1010

11-
import os
12-
1311
import trimesh
12+
from X_library import utilities
13+
14+
utils = utilities()
1415

1516
SAMPLE = 151763271961 # sample with ID to process
1617
RESOLUTIONS = [0.25, 0.2, 0.15, 0.1, 0.05] # 3D voxel resolution
1718

18-
# get the directory where the current python file is
19-
script_dir = os.path.dirname(os.path.abspath(__file__))
20-
21-
2219
for resolution in RESOLUTIONS:
23-
fp = os.path.abspath(os.path.join(script_dir, '..', fr'sample_data\{SAMPLE}_discontinuities.stl'))
20+
fp = utils.make_rel_fp(
21+
fr'sample_data\{SAMPLE}_discontinuities.stl', 1)
2422
discontinuity_mesh = trimesh.load_mesh(fp)
2523
discontinuity_voxels = discontinuity_mesh.voxelized(pitch=resolution)
2624
voxel_mesh = discontinuity_voxels.as_boxes()
27-
fp = os.path.abspath(os.path.join(script_dir, '..', fr'sample_data\{SAMPLE}_{resolution}_voxel_mesh.stl'))
25+
fp = utils.make_rel_fp(
26+
fr'sample_data\{SAMPLE}_{resolution}_voxel_mesh.stl', 1)
2827
voxel_mesh.export(fp)

src/F_MeshChecker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
Script that performs different checks of the generated meshes.
99
"""
1010

11-
import trimesh
1211
from os import listdir
1312

13+
import trimesh
14+
1415
# get ids of all generated meshes
1516
ids = [c.split('_')[0] for c in listdir(r'../combinations') if 'discontinuities' in c]
1617

src/X_library.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
math, general use (utilities), plotting and computation of parameters.
1010
"""
1111

12+
import os
13+
import zlib
14+
1215
import numpy as np
1316
import pandas as pd
1417
from scipy.ndimage import generic_filter, label
@@ -21,13 +24,13 @@
2124
import trimesh
2225
import matplotlib
2326
import matplotlib.gridspec as gridspec
24-
import zlib
2527
matplotlib.use('Agg')
2628
import matplotlib.pyplot as plt
2729
from matplotlib.ticker import FormatStrFormatter
2830

2931

3032
class math:
33+
'''class with mathematical functions'''
3134

3235
def __init__(self):
3336
pass
@@ -54,6 +57,7 @@ def normal_vectors(self, dips, dipdirs):
5457

5558

5659
class utilities:
60+
'''class with miscaleneous functions that don't fit anywhere else'''
5761

5862
def __init__(self):
5963
self.sclr = MinMaxScaler()
@@ -140,8 +144,22 @@ def identify_intact_rock_regions(self, array: np.array) -> list:
140144

141145
return labeled_array, num_features
142146

147+
def make_rel_fp(self, path: str, levels_up: int = 0) -> str:
148+
'''function creates a relative filepath from the executing python file
149+
location'''
150+
script_dir = os.path.dirname(os.path.abspath(__file__))
151+
if levels_up > 0:
152+
lvls = ['..'] * levels_up
153+
path_list = [script_dir] + lvls + [path]
154+
else:
155+
path_list = [script_dir, path]
156+
return os.path.abspath(os.path.join(*path_list))
157+
158+
159+
143160

144161
class plotter(utilities):
162+
'''class with plotting functions'''
145163

146164
def __init__(self):
147165
self.label_map = {
@@ -718,6 +736,8 @@ def Euler_plot(self) -> None:
718736

719737

720738
class parameters:
739+
'''class with functions that compute rock engineering parameters of rock
740+
mass structures'''
721741

722742
def __init__(self):
723743
pass

0 commit comments

Comments
 (0)