gebpy 1.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. gebpy/__init__.py +55 -0
  2. gebpy/__pycache__/__init__.cpython-310.pyc +0 -0
  3. gebpy/adapters/__init__.py +0 -0
  4. gebpy/cli/__init__.py +0 -0
  5. gebpy/core/__init__.py +0 -0
  6. gebpy/core/chemistry/__init__.py +0 -0
  7. gebpy/core/chemistry/common.py +1369 -0
  8. gebpy/core/chemistry/elements.py +317 -0
  9. gebpy/core/chemistry/geochemistry.py +1728 -0
  10. gebpy/core/fluids/__init__.py +0 -0
  11. gebpy/core/io/__init__.py +0 -0
  12. gebpy/core/mathematics/__init__.py +0 -0
  13. gebpy/core/minerals/__init__.py +0 -0
  14. gebpy/core/minerals/carbonates.py +412 -0
  15. gebpy/core/minerals/common.py +555 -0
  16. gebpy/core/minerals/config.py +77 -0
  17. gebpy/core/minerals/cyclosilicates.py +0 -0
  18. gebpy/core/minerals/halides.py +0 -0
  19. gebpy/core/minerals/inosilicates.py +0 -0
  20. gebpy/core/minerals/nesosilicates.py +0 -0
  21. gebpy/core/minerals/organics.py +0 -0
  22. gebpy/core/minerals/oxides.py +589 -0
  23. gebpy/core/minerals/phosphates.py +0 -0
  24. gebpy/core/minerals/phospides.py +0 -0
  25. gebpy/core/minerals/phyllosilicates.py +436 -0
  26. gebpy/core/minerals/sorosilicates.py +0 -0
  27. gebpy/core/minerals/sulfates.py +0 -0
  28. gebpy/core/minerals/sulfides.py +459 -0
  29. gebpy/core/minerals/synthesis.py +201 -0
  30. gebpy/core/minerals/tectosilicates.py +433 -0
  31. gebpy/core/physics/__init__.py +0 -0
  32. gebpy/core/physics/common.py +53 -0
  33. gebpy/core/physics/geophysics.py +351 -0
  34. gebpy/core/rocks/__init__.py +0 -0
  35. gebpy/core/rocks/anisotropic_rocks.py +395 -0
  36. gebpy/core/rocks/common.py +95 -0
  37. gebpy/core/rocks/config.py +77 -0
  38. gebpy/core/rocks/isotropic_rocks.py +395 -0
  39. gebpy/core/rocks/sedimentary.py +385 -0
  40. gebpy/core/subsurface/__init__.py +0 -0
  41. gebpy/data_minerals/__init__.py +0 -0
  42. gebpy/data_minerals/albite.yaml +59 -0
  43. gebpy/data_minerals/anatase.yaml +43 -0
  44. gebpy/data_minerals/ankerite.yaml +47 -0
  45. gebpy/data_minerals/annite.yaml +57 -0
  46. gebpy/data_minerals/anorthite.yaml +59 -0
  47. gebpy/data_minerals/antigorite.yaml +53 -0
  48. gebpy/data_minerals/aragonite.yaml +48 -0
  49. gebpy/data_minerals/argutite.yaml +43 -0
  50. gebpy/data_minerals/arsenolite.yaml +40 -0
  51. gebpy/data_minerals/au3oxide.yaml +46 -0
  52. gebpy/data_minerals/avicennite.yaml +40 -0
  53. gebpy/data_minerals/azurite.yaml +53 -0
  54. gebpy/data_minerals/baddeleyite.yaml +49 -0
  55. gebpy/data_minerals/bismite.yaml +49 -0
  56. gebpy/data_minerals/boehmite.yaml +48 -0
  57. gebpy/data_minerals/brookite.yaml +46 -0
  58. gebpy/data_minerals/brucite.yaml +45 -0
  59. gebpy/data_minerals/bunsenite.yaml +40 -0
  60. gebpy/data_minerals/calcite.yaml +45 -0
  61. gebpy/data_minerals/cassiterite.yaml +43 -0
  62. gebpy/data_minerals/cerussite.yaml +48 -0
  63. gebpy/data_minerals/chamosite.yaml +56 -0
  64. gebpy/data_minerals/chlorite.yaml +75 -0
  65. gebpy/data_minerals/chromite.yaml +42 -0
  66. gebpy/data_minerals/chrysotile.yaml +53 -0
  67. gebpy/data_minerals/claudetite.yaml +49 -0
  68. gebpy/data_minerals/clinochlore.yaml +55 -0
  69. gebpy/data_minerals/cochromite.yaml +42 -0
  70. gebpy/data_minerals/corundum.yaml +43 -0
  71. gebpy/data_minerals/crocoite.yaml +51 -0
  72. gebpy/data_minerals/cuprite.yaml +40 -0
  73. gebpy/data_minerals/cuprospinel.yaml +42 -0
  74. gebpy/data_minerals/diaspore.yaml +48 -0
  75. gebpy/data_minerals/dolomite.yaml +47 -0
  76. gebpy/data_minerals/eastonite.yaml +57 -0
  77. gebpy/data_minerals/eskolaite.yaml +43 -0
  78. gebpy/data_minerals/fechlorite.yaml +61 -0
  79. gebpy/data_minerals/fecolumbite.yaml +48 -0
  80. gebpy/data_minerals/ferberite.yaml +51 -0
  81. gebpy/data_minerals/fetantalite.yaml +48 -0
  82. gebpy/data_minerals/franklinite.yaml +42 -0
  83. gebpy/data_minerals/gahnite.yaml +42 -0
  84. gebpy/data_minerals/galaxite.yaml +42 -0
  85. gebpy/data_minerals/geikielite.yaml +45 -0
  86. gebpy/data_minerals/gibbsite.yaml +51 -0
  87. gebpy/data_minerals/glauconite.yaml +69 -0
  88. gebpy/data_minerals/goethite.yaml +48 -0
  89. gebpy/data_minerals/groutite.yaml +48 -0
  90. gebpy/data_minerals/hematite.yaml +43 -0
  91. gebpy/data_minerals/hercynite.yaml +42 -0
  92. gebpy/data_minerals/huebnerite.yaml +51 -0
  93. gebpy/data_minerals/ikaite.yaml +53 -0
  94. gebpy/data_minerals/illite.yaml +55 -0
  95. gebpy/data_minerals/ilmenite.yaml +45 -0
  96. gebpy/data_minerals/jacobsite.yaml +42 -0
  97. gebpy/data_minerals/kalsilite.yaml +47 -0
  98. gebpy/data_minerals/kaolinite.yaml +59 -0
  99. gebpy/data_minerals/karelianite.yaml +43 -0
  100. gebpy/data_minerals/lime.yaml +40 -0
  101. gebpy/data_minerals/litharge.yaml +43 -0
  102. gebpy/data_minerals/magnesiochromite.yaml +42 -0
  103. gebpy/data_minerals/magnesioferrite.yaml +42 -0
  104. gebpy/data_minerals/magnesite.yaml +45 -0
  105. gebpy/data_minerals/magnetite.yaml +41 -0
  106. gebpy/data_minerals/malachite.yaml +53 -0
  107. gebpy/data_minerals/manganite.yaml +51 -0
  108. gebpy/data_minerals/manganochromite.yaml +42 -0
  109. gebpy/data_minerals/manganosite.yaml +40 -0
  110. gebpy/data_minerals/marialite.yaml +49 -0
  111. gebpy/data_minerals/massicot.yaml +46 -0
  112. gebpy/data_minerals/meionite.yaml +49 -0
  113. gebpy/data_minerals/mgchlorite.yaml +61 -0
  114. gebpy/data_minerals/mgcolumbite.yaml +48 -0
  115. gebpy/data_minerals/mgtantalite.yaml +48 -0
  116. gebpy/data_minerals/microcline.yaml +59 -0
  117. gebpy/data_minerals/minium.yaml +44 -0
  118. gebpy/data_minerals/mnchlorite.yaml +61 -0
  119. gebpy/data_minerals/mncolumbite.yaml +48 -0
  120. gebpy/data_minerals/mntantalite.yaml +48 -0
  121. gebpy/data_minerals/monteponite.yaml +40 -0
  122. gebpy/data_minerals/montmorillonite.yaml +77 -0
  123. gebpy/data_minerals/muscovite.yaml +55 -0
  124. gebpy/data_minerals/nanepheline.yaml +47 -0
  125. gebpy/data_minerals/nichlorite.yaml +61 -0
  126. gebpy/data_minerals/nichromite.yaml +42 -0
  127. gebpy/data_minerals/nimite.yaml +55 -0
  128. gebpy/data_minerals/nontronite.yaml +73 -0
  129. gebpy/data_minerals/orthoclase.yaml +53 -0
  130. gebpy/data_minerals/paratellurite.yaml +43 -0
  131. gebpy/data_minerals/pennantite.yaml +61 -0
  132. gebpy/data_minerals/periclase.yaml +40 -0
  133. gebpy/data_minerals/phlogopite.yaml +57 -0
  134. gebpy/data_minerals/plattnerite.yaml +43 -0
  135. gebpy/data_minerals/powellite.yaml +45 -0
  136. gebpy/data_minerals/pyrite.yaml +40 -0
  137. gebpy/data_minerals/pyrolusite.yaml +43 -0
  138. gebpy/data_minerals/pyrophanite.yaml +45 -0
  139. gebpy/data_minerals/pyrophyllite.yaml +59 -0
  140. gebpy/data_minerals/quartz.yaml +43 -0
  141. gebpy/data_minerals/rhodochrosite.yaml +45 -0
  142. gebpy/data_minerals/rutile.yaml +43 -0
  143. gebpy/data_minerals/saponite.yaml +77 -0
  144. gebpy/data_minerals/scheelite.yaml +45 -0
  145. gebpy/data_minerals/scrutinyite.yaml +46 -0
  146. gebpy/data_minerals/senarmontite.yaml +40 -0
  147. gebpy/data_minerals/siderite.yaml +45 -0
  148. gebpy/data_minerals/siderophyllite.yaml +57 -0
  149. gebpy/data_minerals/smithsonite.yaml +45 -0
  150. gebpy/data_minerals/spinel.yaml +42 -0
  151. gebpy/data_minerals/stishovite.yaml +43 -0
  152. gebpy/data_minerals/stolzite.yaml +45 -0
  153. gebpy/data_minerals/talc.yaml +53 -0
  154. gebpy/data_minerals/tistarite.yaml +43 -0
  155. gebpy/data_minerals/trevorite.yaml +42 -0
  156. gebpy/data_minerals/ulvoespinel.yaml +42 -0
  157. gebpy/data_minerals/uraninite.yaml +40 -0
  158. gebpy/data_minerals/valentinite.yaml +46 -0
  159. gebpy/data_minerals/vermiculite.yaml +69 -0
  160. gebpy/data_minerals/wulfenite.yaml +45 -0
  161. gebpy/data_minerals/wustite.yaml +40 -0
  162. gebpy/data_minerals/zincite.yaml +43 -0
  163. gebpy/data_minerals/zincochromite.yaml +42 -0
  164. gebpy/data_rocks/__init__.py +0 -0
  165. gebpy/data_rocks/dolostone.yaml +40 -0
  166. gebpy/data_rocks/limestone.yaml +40 -0
  167. gebpy/data_rocks/marl.yaml +50 -0
  168. gebpy/data_rocks/sandstone.yaml +39 -0
  169. gebpy/data_rocks/shale.yaml +50 -0
  170. gebpy/gebpy_app.py +8732 -0
  171. gebpy/gui/__init__.py +0 -0
  172. gebpy/lib/images/GebPy_Header.png +0 -0
  173. gebpy/lib/images/GebPy_Icon.png +0 -0
  174. gebpy/lib/images/GebPy_Logo.png +0 -0
  175. gebpy/main.py +29 -0
  176. gebpy/modules/__init__.py +0 -0
  177. gebpy/modules/__pycache__/__init__.cpython-310.pyc +0 -0
  178. gebpy/modules/__pycache__/metamorphics.cpython-310.pyc +0 -0
  179. gebpy/modules/__pycache__/silicates.cpython-310.pyc +0 -0
  180. gebpy/modules/carbonates.py +2658 -0
  181. gebpy/modules/chemistry.py +1369 -0
  182. gebpy/modules/core.py +1805 -0
  183. gebpy/modules/elements.py +317 -0
  184. gebpy/modules/evaporites.py +1299 -0
  185. gebpy/modules/exploration.py +1145 -0
  186. gebpy/modules/fluids.py +339 -0
  187. gebpy/modules/geochemistry.py +1727 -0
  188. gebpy/modules/geophysics.py +351 -0
  189. gebpy/modules/gui.py +9093 -0
  190. gebpy/modules/gui_elements.py +145 -0
  191. gebpy/modules/halides.py +485 -0
  192. gebpy/modules/igneous.py +2241 -0
  193. gebpy/modules/metamorphics.py +3222 -0
  194. gebpy/modules/mineralogy.py +442 -0
  195. gebpy/modules/minerals.py +7954 -0
  196. gebpy/modules/ore.py +1648 -0
  197. gebpy/modules/organics.py +530 -0
  198. gebpy/modules/oxides.py +9057 -0
  199. gebpy/modules/petrophysics.py +98 -0
  200. gebpy/modules/phosphates.py +589 -0
  201. gebpy/modules/phospides.py +194 -0
  202. gebpy/modules/plotting.py +619 -0
  203. gebpy/modules/pyllosilicates.py +380 -0
  204. gebpy/modules/sedimentary_rocks.py +908 -0
  205. gebpy/modules/sequences.py +2166 -0
  206. gebpy/modules/series.py +1625 -0
  207. gebpy/modules/silicates.py +11102 -0
  208. gebpy/modules/siliciclastics.py +1846 -0
  209. gebpy/modules/subsurface_2d.py +179 -0
  210. gebpy/modules/sulfates.py +1629 -0
  211. gebpy/modules/sulfides.py +4786 -0
  212. gebpy/plotting/__init__.py +0 -0
  213. gebpy/ui_nb/__init__.py +0 -0
  214. gebpy/user_data/.gitkeep +0 -0
  215. gebpy-1.1.3.dist-info/LICENSE +165 -0
  216. gebpy-1.1.3.dist-info/METADATA +207 -0
  217. gebpy-1.1.3.dist-info/RECORD +254 -0
  218. gebpy-1.1.3.dist-info/WHEEL +5 -0
  219. gebpy-1.1.3.dist-info/entry_points.txt +2 -0
  220. gebpy-1.1.3.dist-info/top_level.txt +1 -0
  221. modules/__init__.py +0 -0
  222. modules/carbonates.py +2658 -0
  223. modules/chemistry.py +1369 -0
  224. modules/core.py +1805 -0
  225. modules/elements.py +317 -0
  226. modules/evaporites.py +1299 -0
  227. modules/exploration.py +765 -0
  228. modules/fluids.py +339 -0
  229. modules/geochemistry.py +1727 -0
  230. modules/geophysics.py +337 -0
  231. modules/gui.py +9093 -0
  232. modules/gui_elements.py +145 -0
  233. modules/halides.py +485 -0
  234. modules/igneous.py +2196 -0
  235. modules/metamorphics.py +2699 -0
  236. modules/mineralogy.py +442 -0
  237. modules/minerals.py +7954 -0
  238. modules/ore.py +1628 -0
  239. modules/organics.py +530 -0
  240. modules/oxides.py +9057 -0
  241. modules/petrophysics.py +98 -0
  242. modules/phosphates.py +589 -0
  243. modules/phospides.py +194 -0
  244. modules/plotting.py +619 -0
  245. modules/pyllosilicates.py +380 -0
  246. modules/sedimentary_rocks.py +908 -0
  247. modules/sequences.py +2166 -0
  248. modules/series.py +1625 -0
  249. modules/silicates.py +11102 -0
  250. modules/siliciclastics.py +1830 -0
  251. modules/subsurface_2d.py +179 -0
  252. modules/sulfates.py +1629 -0
  253. modules/sulfides.py +4786 -0
  254. notebooks/__init__.py +0 -0
@@ -0,0 +1,1145 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- -
5
+
6
+ # File: exploration.py
7
+ # Description: Contains all necessary functions that are related to mineral exploration feature
8
+ # Author: Maximilian Beeskow
9
+ # Last updated: 20.12.2024
10
+ # License: GPL v3.0
11
+
12
+ # ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- -
13
+
14
+ # external packages
15
+ import tkinter as tk
16
+ from tkinter import ttk
17
+ from tkinter import filedialog
18
+ import numpy as np
19
+ import pandas as pd
20
+ import os
21
+ # internal packages
22
+ try:
23
+ from gebpy.modules.gui_elements import SimpleElements
24
+ from gebpy.modules.siliciclastics import SiliciclasticRocks
25
+ from gebpy.modules.carbonates import CarbonateRocks
26
+ from gebpy.modules.igneous import Plutonic, Volcanic, UltraMafic, Pyroclastic
27
+ from gebpy.modules.metamorphics import GranuliteFacies, GreenschistFacies, AmphiboliteFacies
28
+ from gebpy.modules.ore import OreRocks
29
+ except:
30
+ from modules.gui_elements import SimpleElements
31
+ from modules.siliciclastics import SiliciclasticRocks
32
+ from modules.carbonates import CarbonateRocks
33
+ from modules.igneous import Plutonic, Volcanic, UltraMafic, Pyroclastic
34
+ from modules.metamorphics import GranuliteFacies, GreenschistFacies, AmphiboliteFacies
35
+ from modules.ore import OreRocks
36
+
37
+ # ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- -
38
+
39
+
40
+ class ExplorationInterface:
41
+
42
+ def __init__(self, parent):
43
+ self.parent = parent
44
+ self.colors = {
45
+ "Background": "#ECEBEA", "Navigation": "#252422", "Accent": "#EB5E28", "Option": "#CCC5B9",
46
+ "White": "#FFFFFF", "Black": "#000000", "Accent Blue": "#118AB2"}
47
+
48
+ # Variables
49
+ self.initialization = False
50
+
51
+ self.var_rb_setup = tk.IntVar()
52
+ self.var_rb_setup.set(0)
53
+
54
+ self.var_entr_boreholes = tk.IntVar()
55
+ self.var_entr_boreholes.set(2)
56
+ self.var_entr_units = tk.IntVar()
57
+ self.var_entr_units.set(4)
58
+ self.var_entr_maximum_depth = tk.IntVar()
59
+ self.var_entr_maximum_depth.set(100)
60
+ self.var_entr_parts = tk.IntVar()
61
+ self.var_entr_parts.set(10)
62
+ self.dict_entr_top = {}
63
+ self.dict_entr_bottom = {}
64
+ self.var_entr_top = tk.StringVar()
65
+ self.var_entr_top.set("0.0")
66
+ self.var_entr_bottom = tk.StringVar()
67
+ self.var_entr_bottom.set("25.0")
68
+
69
+ self.var_opt_sedimentary = tk.StringVar()
70
+ self.var_opt_sedimentary.set("Select sedimentary rock")
71
+ self.var_opt_plutonic = tk.StringVar()
72
+ self.var_opt_plutonic.set("Select plutonic rock")
73
+ self.var_opt_volcanic = tk.StringVar()
74
+ self.var_opt_volcanic.set("Select volcanic rock")
75
+ self.var_opt_ore = tk.StringVar()
76
+ self.var_opt_ore.set("Select ore rock")
77
+ self.var_opt_igneous = tk.StringVar()
78
+ self.var_opt_igneous.set("Select igneous rock")
79
+ self.var_opt_metamorphic = tk.StringVar()
80
+ self.var_opt_metamorphic.set("Select metamorphic rock")
81
+ self.var_opt_ultramafic = tk.StringVar()
82
+ self.var_opt_ultramafic.set("Select ultramafic rock")
83
+
84
+ def create_subwindow_borehole_data(self):
85
+ ## Window Settings
86
+ window_width = 1200
87
+ window_height = 775
88
+ var_geometry = str(window_width) + "x" + str(window_height) + "+" + str(0) + "+" + str(0)
89
+
90
+ row_min = 25
91
+ self.n_rows = int(window_height/row_min)
92
+ column_min = 20
93
+ n_columns = int(window_width/column_min)
94
+
95
+ str_title_window = "GebPy - Borehole data"
96
+ self.subwindow_borehole_data = tk.Toplevel(self.parent)
97
+ self.subwindow_borehole_data.title(str_title_window)
98
+ self.subwindow_borehole_data.geometry(var_geometry)
99
+ self.subwindow_borehole_data.resizable(False, False)
100
+ self.subwindow_borehole_data["bg"] = self.colors["Navigation"]
101
+
102
+ for x in range(n_columns):
103
+ tk.Grid.columnconfigure(self.subwindow_borehole_data, x, weight=1)
104
+ for y in range(self.n_rows):
105
+ tk.Grid.rowconfigure(self.subwindow_borehole_data, y, weight=1)
106
+
107
+ # Rows
108
+ for i in range(0, self.n_rows):
109
+ self.subwindow_borehole_data.grid_rowconfigure(i, minsize=row_min)
110
+ # Columns
111
+ for i in range(0, n_columns):
112
+ self.subwindow_borehole_data.grid_columnconfigure(i, minsize=column_min)
113
+
114
+ self.start_row = 0
115
+ self.n_columns_setup = 11
116
+
117
+ ## Frames
118
+ SimpleElements(
119
+ parent=self.subwindow_borehole_data, row_id=self.start_row, column_id=self.n_columns_setup + 1,
120
+ n_rows=self.n_rows, n_columns=n_columns - self.n_columns_setup - 1, bg=self.colors["Background"],
121
+ fg=self.colors["Background"]).create_frame()
122
+
123
+ ## Labels
124
+ SimpleElements(
125
+ parent=self.subwindow_borehole_data, row_id=self.start_row, column_id=1, n_rows=1,
126
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
127
+ text="Settings", relief=tk.FLAT, font_option="sans 12 bold", anchor_option=tk.W)
128
+
129
+ ## Initialization
130
+ self.container_borehole_lithology = {}
131
+ self.container_lithology_data = {}
132
+ if self.initialization == False:
133
+ self.select_dataset_setup()
134
+ self.update_settings(initialization=True)
135
+ self.initialization = True
136
+
137
+ def select_dataset_setup(self):
138
+ if self.var_rb_setup.get() == 0:
139
+ ## Labels
140
+ SimpleElements(
141
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 1, column_id=1, n_rows=1,
142
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
143
+ text="Number of boreholes (#)", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
144
+ SimpleElements(
145
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 3, column_id=1, n_rows=1,
146
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
147
+ text="Number of units (#)", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
148
+ SimpleElements(
149
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 5, column_id=1, n_rows=1,
150
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
151
+ text="Maximum depth (m)", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
152
+ SimpleElements(
153
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 7, column_id=1, n_rows=1,
154
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
155
+ text="Samples per unit (#)", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
156
+
157
+ ## Entries
158
+ SimpleElements(
159
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 2, column_id=1, n_rows=1,
160
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
161
+ fg=self.colors["Navigation"]).create_entry(var_entr=self.var_entr_boreholes)
162
+ SimpleElements(
163
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 4, column_id=1, n_rows=1,
164
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
165
+ fg=self.colors["Navigation"]).create_entry(var_entr=self.var_entr_units)
166
+ SimpleElements(
167
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 6, column_id=1, n_rows=1,
168
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
169
+ fg=self.colors["Navigation"]).create_entry(var_entr=self.var_entr_maximum_depth)
170
+ SimpleElements(
171
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 8, column_id=1, n_rows=1,
172
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
173
+ fg=self.colors["Navigation"]).create_entry(var_entr=self.var_entr_parts)
174
+
175
+ ## Buttons
176
+ btn_01 = SimpleElements(
177
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 10, column_id=1, n_rows=1,
178
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
179
+ fg=self.colors["Navigation"]).create_button(
180
+ text="Update settings", command=lambda initialization=False, update=True:
181
+ self.update_settings(initialization, update))
182
+ btn_01.configure(activebackground=self.colors["Accent"])
183
+
184
+ elif self.var_rb_setup.get() == 1:
185
+ print("Load dataset!")
186
+
187
+ def update_settings(self, initialization=False, update=False, changed_borehole=False):
188
+ """Updates the data for the borehole and unit data.
189
+ Arguments
190
+ initialization, boolean : specifies if the function runs the first time.
191
+ update, boolean : specifies if it has only to update already existing variables.
192
+ changed_borehole, boolean : specifies if only the ID of a borehole was changed.
193
+ Outputs
194
+ ---
195
+ """
196
+ ## Helper
197
+ if initialization or update and changed_borehole == False:
198
+ self.list_boreholes = np.arange(self.var_entr_boreholes.get()) + 1
199
+ self.list_units = np.arange(self.var_entr_units.get()) + 1
200
+ self.current_borehole_id = self.list_boreholes[0]
201
+ self.current_unit_id = self.list_units[0]
202
+
203
+ for index_borehole, borehole_id in enumerate(self.list_boreholes):
204
+ self.dict_entr_top[borehole_id] = {}
205
+ self.dict_entr_bottom[borehole_id] = {}
206
+ average_thickness = round(self.var_entr_maximum_depth.get()/len(self.list_units), 2)
207
+ current_bottom_depth = 0
208
+ for index_unit, unit_id in enumerate(self.list_units):
209
+ self.dict_entr_top[borehole_id][unit_id] = tk.IntVar()
210
+ self.dict_entr_bottom[borehole_id][unit_id] = tk.IntVar()
211
+
212
+ if index_unit == 0:
213
+ self.dict_entr_top[borehole_id][unit_id].set(0)
214
+ current_bottom_depth += average_thickness
215
+ self.dict_entr_bottom[borehole_id][unit_id].set(round(current_bottom_depth))
216
+ else:
217
+ self.dict_entr_top[borehole_id][unit_id].set(round(current_bottom_depth))
218
+ current_bottom_depth += average_thickness
219
+ self.dict_entr_bottom[borehole_id][unit_id].set(round(current_bottom_depth))
220
+
221
+ if initialization:
222
+ ## Labels
223
+ SimpleElements(
224
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 12, column_id=1, n_rows=1,
225
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
226
+ text="Current borehole", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
227
+ self.lbl_borehole_id = SimpleElements(
228
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 13, column_id=1, n_rows=1, n_columns=2,
229
+ bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
230
+ text=self.current_borehole_id, relief=tk.FLAT, font_option="sans 10 bold")
231
+ SimpleElements(
232
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 14, column_id=1, n_rows=1,
233
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
234
+ text="Current unit", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
235
+ self.lbl_unit_id = SimpleElements(
236
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 15, column_id=1, n_rows=1, n_columns=2,
237
+ bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
238
+ text=self.current_unit_id, relief=tk.FLAT, font_option="sans 10 bold")
239
+ SimpleElements(
240
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 17, column_id=1, n_rows=1,
241
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
242
+ text="Lithology", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
243
+ SimpleElements(
244
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 25, column_id=1, n_rows=1, n_columns=6,
245
+ bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
246
+ text="Top depth (m)", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
247
+ SimpleElements(
248
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 26, column_id=1, n_rows=1, n_columns=6,
249
+ bg=self.colors["Navigation"], fg=self.colors["White"]).create_label(
250
+ text="Bottom depth (m)", relief=tk.FLAT, font_option="sans 10 bold", anchor_option=tk.W)
251
+
252
+ ## Buttons
253
+ btn_02 = SimpleElements(
254
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 13, column_id=3, n_rows=1, n_columns=4,
255
+ bg=self.colors["Background"], fg=self.colors["Navigation"]).create_button(
256
+ text="Previous", command=lambda mode="previous": self.change_borehole(mode))
257
+ btn_03 = SimpleElements(
258
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 13, column_id=7, n_rows=1, n_columns=4,
259
+ bg=self.colors["Background"], fg=self.colors["Navigation"]).create_button(
260
+ text="Next", command=lambda mode="next": self.change_borehole(mode))
261
+ btn_04 = SimpleElements(
262
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 15, column_id=3, n_rows=1, n_columns=4,
263
+ bg=self.colors["Background"], fg=self.colors["Navigation"]).create_button(
264
+ text="Previous", command=lambda mode="previous": self.change_unit(mode))
265
+ btn_05 = SimpleElements(
266
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 15, column_id=7, n_rows=1, n_columns=4,
267
+ bg=self.colors["Background"], fg=self.colors["Navigation"]).create_button(
268
+ text="Next", command=lambda mode="next": self.change_unit(mode))
269
+ btn_06 = SimpleElements(
270
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 28, column_id=1, n_rows=1,
271
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
272
+ fg=self.colors["Navigation"]).create_button(text="Load drilling data", command=self.load_drilling_data)
273
+ btn_07 = SimpleElements(
274
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 29, column_id=1, n_rows=1,
275
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
276
+ fg=self.colors["Navigation"]).create_button(text="Export data", command=self.export_borehole_data)
277
+ btn_02.configure(activebackground=self.colors["Accent"])
278
+ btn_03.configure(activebackground=self.colors["Accent"])
279
+ btn_04.configure(activebackground=self.colors["Accent"])
280
+ btn_05.configure(activebackground=self.colors["Accent"])
281
+ btn_06.configure(activebackground=self.colors["Accent"])
282
+ btn_07.configure(activebackground=self.colors["Accent"])
283
+
284
+ ## Entries
285
+ self.entr_top = SimpleElements(
286
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 25, column_id=7, n_rows=1, n_columns=4,
287
+ bg=self.colors["Background"], fg=self.colors["Navigation"]).create_entry(
288
+ var_entr=self.dict_entr_top[self.current_borehole_id][self.current_unit_id])
289
+ self.entr_bottom = SimpleElements(
290
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 26, column_id=7, n_rows=1, n_columns=4,
291
+ bg=self.colors["Background"], fg=self.colors["Navigation"]).create_entry(
292
+ var_entr=self.dict_entr_bottom[self.current_borehole_id][self.current_unit_id])
293
+ self.entr_top.bind(
294
+ "<Return>", lambda event, mode="top": self.change_depth(mode, event))
295
+ self.entr_bottom.bind(
296
+ "<Return>", lambda event, mode="bottom": self.change_depth(mode, event))
297
+
298
+ if self.current_unit_id == 1:
299
+ self.entr_top.configure(state="disabled")
300
+ else:
301
+ self.entr_top.configure(state="normal")
302
+
303
+ if self.current_unit_id == self.list_units[-1]:
304
+ self.entr_bottom.configure(state="disabled")
305
+ else:
306
+ self.entr_bottom.configure(state="normal")
307
+
308
+ ## Option Menus
309
+ list_opt_sedimentary = [
310
+ "Sandstone", "Shale", "Siltstone", "Mudstone", "Greywacke (Huckenholz)", "Conglomerate", "Limestone",
311
+ "Dolostone", "Marl"]
312
+ list_opt_plutonic = [
313
+ "Granite", "Granodiorite", "Tonalite", "Gabbro", "Norite", "Diorite", "Monzodiorite", "Monzogabbro",
314
+ "Monzonite", "Syenite", "Granitoid", "Quarzolite", "Foid-bearing Syenite", "Foid-bearing Monzonite",
315
+ "Foid-bearing Monzodiorite", "Foid-bearing Monzogabbro", "Foid Monzosyenite", "Foid Monzodiorite",
316
+ "Foid Monzogabbro", "Foidolite"]
317
+ list_opt_volcanic = [
318
+ "Rhyolite", "Dacite", "Trachyte", "Latite", "Andesite", "Basalt",
319
+ "Foid-bearing Trachyte", "Foid-bearing Latite", "Foid-bearing Andesite", "Foid-bearing Basalt",
320
+ "Phonolite", "Tephrite", "Foidite"]
321
+ list_opt_ultramafic = [
322
+ "Orthopyroxenite", "Clinopyroxenite", "Dunite", "Harzburgite", "Wehrlite", "Websterite", "Lherzolite",
323
+ "Olivine-Websterite", "Olivine-Orthopyroxenite", "Olivine-Clinopyroxenite", "Peridotite", "Pyroxenite"]
324
+ list_opt_metamorphic = [
325
+ "Felsic Granulite", "Mafic Granulite", "Basaltic Greenschist", "Ultramafic Greenschist",
326
+ "Pelitic Greenschist", "Greenstone", "Ortho-Amphibolite"]
327
+ list_opt_ore = [
328
+ "Itabirite", "Banded Iron Formation", "Compact Hematite", "Friable Hematite", "Goethite Hematite",
329
+ "Al-rich Itabirite", "Compact Quartz Itabirite", "Friable Quartz Itabirite", "Goethite Itabirite"]
330
+ opt_sedimentary = SimpleElements(
331
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 18, column_id=1, n_rows=1,
332
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
333
+ fg=self.colors["Navigation"]).create_option_menu(
334
+ var_opt=self.var_opt_sedimentary, var_opt_set=self.var_opt_sedimentary.get(),
335
+ opt_list=list_opt_sedimentary, active_bg=self.colors["Accent"],
336
+ command=lambda event, focus="sedimentary": self.select_lithology(focus, event))
337
+ opt_plutonic = SimpleElements(
338
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 19, column_id=1, n_rows=1,
339
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
340
+ fg=self.colors["Navigation"]).create_option_menu(
341
+ var_opt=self.var_opt_plutonic, var_opt_set=self.var_opt_plutonic.get(), opt_list=list_opt_plutonic,
342
+ active_bg=self.colors["Accent"], command=lambda event, focus="plutonic":
343
+ self.select_lithology(focus, event))
344
+ opt_volcanic = SimpleElements(
345
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 20, column_id=1, n_rows=1,
346
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
347
+ fg=self.colors["Navigation"]).create_option_menu(
348
+ var_opt=self.var_opt_volcanic, var_opt_set=self.var_opt_volcanic.get(), opt_list=list_opt_volcanic,
349
+ active_bg=self.colors["Accent"], command=lambda event, focus="volcanic":
350
+ self.select_lithology(focus, event))
351
+ opt_ultramafic = SimpleElements(
352
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 21, column_id=1, n_rows=1,
353
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
354
+ fg=self.colors["Navigation"]).create_option_menu(
355
+ var_opt=self.var_opt_ultramafic, var_opt_set=self.var_opt_ultramafic.get(),
356
+ opt_list=list_opt_ultramafic, active_bg=self.colors["Accent"],
357
+ command=lambda event, focus="ultramafic": self.select_lithology(focus, event))
358
+ opt_metamorphic = SimpleElements(
359
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 22, column_id=1, n_rows=1,
360
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
361
+ fg=self.colors["Navigation"]).create_option_menu(
362
+ var_opt=self.var_opt_metamorphic, var_opt_set=self.var_opt_metamorphic.get(),
363
+ opt_list=list_opt_metamorphic, active_bg=self.colors["Accent"],
364
+ command=lambda event, focus="metamorphic": self.select_lithology(focus, event))
365
+ opt_ore = SimpleElements(
366
+ parent=self.subwindow_borehole_data, row_id=self.start_row + 23, column_id=1, n_rows=1,
367
+ n_columns=self.n_columns_setup - 1, bg=self.colors["Background"],
368
+ fg=self.colors["Navigation"]).create_option_menu(
369
+ var_opt=self.var_opt_ore, var_opt_set=self.var_opt_ore.get(),
370
+ opt_list=list_opt_ore, active_bg=self.colors["Accent"],
371
+ command=lambda event, focus="ore": self.select_lithology(focus, event))
372
+ opt_sedimentary.configure(anchor=tk.W)
373
+ opt_plutonic.configure(anchor=tk.W)
374
+ opt_volcanic.configure(anchor=tk.W)
375
+ opt_ultramafic.configure(anchor=tk.W)
376
+ opt_metamorphic.configure(anchor=tk.W)
377
+ opt_ore.configure(anchor=tk.W)
378
+
379
+ ## Treeviews (Rock data)
380
+ self.categories = ["rho (kg/m\u00B3)", "phi (%)", "vP (m/s)", "vS (m/s)", "vP/vS (1)", "K (GPa)", "G (GPa)",
381
+ "E (GPa)", "nu (1)", "GR (API)", "PE (barns/e\u207B)"]
382
+ list_categories = ["Category", "Minimum", "Maximum", "Mean", "Standard Deviation"]
383
+ list_width = list(75*np.ones(len(list_categories)))
384
+ list_width = [int(item) for item in list_width]
385
+ list_width[0] = 90
386
+ list_width[-1] = 135
387
+
388
+ self.tv_lithology = SimpleElements(
389
+ parent=self.subwindow_borehole_data, row_id=self.start_row, column_id=self.n_columns_setup + 1,
390
+ n_rows=self.n_rows - 1, n_columns=2*self.n_columns_setup + 1, fg=self.colors["Black"],
391
+ bg=self.colors["White"]).create_treeview(
392
+ n_categories=len(list_categories), text_n=list_categories, width_n=list_width, individual=True)
393
+
394
+ scb_v = ttk.Scrollbar(self.subwindow_borehole_data, orient="vertical")
395
+ scb_h = ttk.Scrollbar(self.subwindow_borehole_data, orient="horizontal")
396
+ self.tv_lithology.configure(xscrollcommand=scb_h.set, yscrollcommand=scb_v.set)
397
+ scb_v.config(command=self.tv_lithology.yview)
398
+ scb_h.config(command=self.tv_lithology.xview)
399
+ scb_v.grid(
400
+ row=0, column=3*self.n_columns_setup + 2, rowspan=self.n_rows - 1, columnspan=1, sticky="ns")
401
+ scb_h.grid(
402
+ row=self.n_rows - 1, column=self.n_columns_setup + 1, rowspan=1, columnspan=2*self.n_columns_setup + 1,
403
+ sticky="ew")
404
+
405
+ for index, category in enumerate(self.categories):
406
+ entries = [category]
407
+ n_digits = 3
408
+ var_entr_min = round(0, n_digits)
409
+ var_entr_max = round(0, n_digits)
410
+ var_entr_mean = round(0, n_digits)
411
+ var_entr_error = round(0, n_digits)
412
+
413
+ entries.extend([var_entr_min, var_entr_max, var_entr_mean, var_entr_error])
414
+
415
+ self.tv_lithology.insert("", tk.END, values=entries)
416
+
417
+ ## Treeviews (Borehole data)
418
+ list_categories = ["Borehole", "Unit", "Top", "Bottom", "Lithology"]
419
+ list_width = list(75*np.ones(len(list_categories)))
420
+ list_width = [int(item) for item in list_width]
421
+ list_width[0] = 75
422
+ list_width[-1] = 150
423
+
424
+ self.tv_borehole = SimpleElements(
425
+ parent=self.subwindow_borehole_data, row_id=self.start_row, column_id=3*self.n_columns_setup + 3,
426
+ n_rows=self.n_rows - 1, n_columns=2*self.n_columns_setup + 1, fg=self.colors["Black"],
427
+ bg=self.colors["White"]).create_treeview(
428
+ n_categories=len(list_categories), text_n=list_categories, width_n=list_width, individual=True)
429
+
430
+ scb_v = ttk.Scrollbar(self.subwindow_borehole_data, orient="vertical")
431
+ scb_h = ttk.Scrollbar(self.subwindow_borehole_data, orient="horizontal")
432
+ self.tv_borehole.configure(xscrollcommand=scb_h.set, yscrollcommand=scb_v.set)
433
+ scb_v.config(command=self.tv_borehole.yview)
434
+ scb_h.config(command=self.tv_borehole.xview)
435
+ scb_v.grid(
436
+ row=0, column=5*self.n_columns_setup + 4, rowspan=self.n_rows - 1, columnspan=1, sticky="ns")
437
+ scb_h.grid(
438
+ row=self.n_rows - 1, column=3*self.n_columns_setup + 3, rowspan=1,
439
+ columnspan=2*self.n_columns_setup + 1, sticky="ew")
440
+
441
+ n = 0
442
+ for i in self.list_boreholes:
443
+ if i not in self.container_borehole_lithology:
444
+ self.container_borehole_lithology[i] = {}
445
+ if n == 4:
446
+ entries = ["-", "-", "-", "-", "-"]
447
+ self.tv_borehole.insert("", tk.END, values=entries)
448
+ n = 0
449
+ for j in self.list_units:
450
+ name = "undefined"
451
+
452
+ if j not in self.container_borehole_lithology[i]:
453
+ self.container_borehole_lithology[i][j] = tk.StringVar()
454
+ self.container_borehole_lithology[i][j].set(name)
455
+
456
+ var_entr_top = self.dict_entr_top[i][j].get()
457
+ var_entr_bottom = self.dict_entr_bottom[i][j].get()
458
+ var_entr_name = self.container_borehole_lithology[i][j].get()
459
+ entries = [i, j, var_entr_top, var_entr_bottom, var_entr_name]
460
+ self.tv_borehole.insert("", tk.END, values=entries)
461
+ n += 1
462
+
463
+ if update:
464
+ self.lbl_borehole_id.configure(text=self.current_borehole_id)
465
+ self.lbl_unit_id.configure(text=self.current_unit_id)
466
+ self.entr_top.configure(textvariable=self.dict_entr_top[self.current_borehole_id][self.current_unit_id])
467
+ self.entr_bottom.configure(textvariable=self.dict_entr_bottom[self.current_borehole_id][
468
+ self.current_unit_id])
469
+ self.var_opt_sedimentary.set("Select sedimentary rock")
470
+ self.var_opt_igneous.set("Select igneous rock")
471
+ self.var_opt_metamorphic.set("Select metamorphic rock")
472
+ self.update_borehole_table()
473
+
474
+ def change_borehole(self, mode):
475
+ """Changes the borehole.
476
+ Arguments
477
+ mode, str : specifies which borehole was selected.
478
+ Outputs
479
+ ---
480
+ """
481
+ if mode == "previous":
482
+ if self.current_borehole_id == 1:
483
+ self.current_borehole_id = self.list_boreholes[-1]
484
+ else:
485
+ self.current_borehole_id = self.current_borehole_id - 1
486
+ elif mode == "next":
487
+ if self.current_borehole_id == self.list_boreholes[-1]:
488
+ self.current_borehole_id = 1
489
+ else:
490
+ self.current_borehole_id += 1
491
+
492
+ self.lbl_borehole_id.configure(text=self.current_borehole_id)
493
+ self.current_unit_id = self.list_units[0]
494
+
495
+ try:
496
+ self.fill_lithology_table(dataset=self.data, categories_long=self.categories)
497
+ except:
498
+ print("Please select first a lithology.")
499
+
500
+ self.update_settings(initialization=False, update=True, changed_borehole=True)
501
+
502
+ def change_unit(self, mode):
503
+ """Changes the unit within a borehole.
504
+ Arguments
505
+ mode, str : specifies which unit was selected.
506
+ Outputs
507
+ ---
508
+ """
509
+ if mode == "previous":
510
+ if self.current_unit_id == 1:
511
+ self.current_unit_id = self.list_units[-1]
512
+ else:
513
+ self.current_unit_id -= 1
514
+
515
+ self.entr_top.configure(textvariable=self.dict_entr_top[self.current_borehole_id][self.current_unit_id])
516
+ self.entr_bottom.configure(textvariable=self.dict_entr_bottom[self.current_borehole_id][
517
+ self.current_unit_id])
518
+
519
+ if self.current_unit_id == 1:
520
+ self.entr_top.configure(state="disabled")
521
+ else:
522
+ self.entr_top.configure(state="normal")
523
+
524
+ if self.current_unit_id == self.list_units[-1]:
525
+ self.entr_bottom.configure(state="disabled")
526
+ else:
527
+ self.entr_bottom.configure(state="normal")
528
+
529
+ elif mode == "next":
530
+ if self.current_unit_id == self.list_units[-1]:
531
+ self.current_unit_id = 1
532
+ else:
533
+ self.current_unit_id += 1
534
+
535
+ self.entr_top.configure(textvariable=self.dict_entr_top[self.current_borehole_id][self.current_unit_id])
536
+ self.entr_bottom.configure(textvariable=self.dict_entr_bottom[self.current_borehole_id][
537
+ self.current_unit_id])
538
+
539
+ if self.current_unit_id == 1:
540
+ self.entr_top.configure(state="disabled")
541
+ else:
542
+ self.entr_top.configure(state="normal")
543
+
544
+ if self.current_unit_id == self.list_units[-1]:
545
+ self.entr_bottom.configure(state="disabled")
546
+ else:
547
+ self.entr_bottom.configure(state="normal")
548
+
549
+ self.lbl_unit_id.configure(text=self.current_unit_id)
550
+
551
+ try:
552
+ self.fill_lithology_table(dataset=self.data, categories_long=self.categories)
553
+ except:
554
+ print("Please select first a lithology.")
555
+
556
+ def change_depth(self, mode, event):
557
+ """Changes the depth of the top or bottom.
558
+ Arguments
559
+ mode, str : specifies if top or bottom was selected.
560
+ Outputs
561
+ ---
562
+ """
563
+ if mode == "top":
564
+ if self.current_unit_id >= 2:
565
+ new_depth = self.dict_entr_top[self.current_borehole_id][self.current_unit_id].get()
566
+ current_top_depth_above = self.dict_entr_top[self.current_borehole_id][self.current_unit_id - 1].get()
567
+
568
+ if new_depth > current_top_depth_above:
569
+ self.dict_entr_bottom[self.current_borehole_id][self.current_unit_id - 1].set(new_depth)
570
+ else:
571
+ self.dict_entr_top[self.current_borehole_id][self.current_unit_id].set(current_top_depth_above + 1)
572
+ self.dict_entr_bottom[self.current_borehole_id][self.current_unit_id - 1].set(
573
+ current_top_depth_above + 1)
574
+
575
+ elif mode == "bottom":
576
+ if self.current_unit_id <= len(self.list_units):
577
+ new_depth = self.dict_entr_bottom[self.current_borehole_id][self.current_unit_id].get()
578
+ current_bottom_depth_below = self.dict_entr_bottom[self.current_borehole_id][
579
+ self.current_unit_id + 1].get()
580
+
581
+ if new_depth < current_bottom_depth_below:
582
+ self.dict_entr_top[self.current_borehole_id][self.current_unit_id + 1].set(new_depth)
583
+ else:
584
+ self.dict_entr_bottom[self.current_borehole_id][self.current_unit_id].set(
585
+ current_bottom_depth_below - 1)
586
+ self.dict_entr_top[self.current_borehole_id][self.current_unit_id + 1].set(
587
+ current_bottom_depth_below - 1)
588
+
589
+ self.update_borehole_table()
590
+
591
+ def select_lithology(self, focus, event):
592
+ """Selects a lithology (e.g. sandstone, granite, ...).
593
+ Arguments
594
+ focus, str : specifies which lithology was selected.
595
+ Outputs
596
+ ---
597
+ """
598
+ if len(self.tv_lithology.get_children()) > 0:
599
+ for item in self.tv_lithology.get_children():
600
+ self.tv_lithology.delete(item)
601
+
602
+ n_datapoints = self.var_entr_parts.get()
603
+ self.categories = ["rho (kg/m\u00B3)", "phi (%)", "vP (m/s)", "vS (m/s)", "vP/vS (1)", "K (GPa)", "G (GPa)",
604
+ "E (GPa)", "nu (1)", "GR (API)", "PE (barns/e\u207B)"]
605
+ self.categories_short = ["rho", "phi", "vP", "vS", "vPvS", "K", "G", "E", "v", "GR", "PE"]
606
+ borehole_id = self.current_borehole_id
607
+ unit_id = self.current_unit_id
608
+
609
+ if focus == "sedimentary":
610
+ self.var_opt_plutonic.set("Select plutonic rock")
611
+ self.var_opt_volcanic.set("Select volcanic rock")
612
+ self.var_opt_ultramafic.set("Select ultramafic rock")
613
+ self.var_opt_metamorphic.set("Select metamorphic rock")
614
+ self.var_opt_ore.set("Select ore rock")
615
+
616
+ # Siliciclastic rocks
617
+ self.data = self.generate_rock_data(rockname=self.var_opt_sedimentary.get())
618
+
619
+ self.container_borehole_lithology[borehole_id][unit_id].set(self.var_opt_sedimentary.get())
620
+
621
+ if self.var_opt_sedimentary.get() not in self.container_lithology_data:
622
+ self.container_lithology_data[self.var_opt_sedimentary.get()] = self.data.copy()
623
+ elif focus == "plutonic":
624
+ self.var_opt_sedimentary.set("Select sedimentary rock")
625
+ self.var_opt_volcanic.set("Select volcanic rock")
626
+ self.var_opt_ultramafic.set("Select ultramafic rock")
627
+ self.var_opt_metamorphic.set("Select metamorphic rock")
628
+ self.var_opt_ore.set("Select ore rock")
629
+
630
+ self.data = self.generate_rock_data(rockname=self.var_opt_plutonic.get())
631
+
632
+ self.container_borehole_lithology[borehole_id][unit_id].set(self.var_opt_plutonic.get())
633
+
634
+ if self.var_opt_plutonic.get() not in self.container_lithology_data:
635
+ self.container_lithology_data[self.var_opt_plutonic.get()] = self.data.copy()
636
+ elif focus == "volcanic":
637
+ self.var_opt_sedimentary.set("Select sedimentary rock")
638
+ self.var_opt_plutonic.set("Select plutonic rock")
639
+ self.var_opt_ultramafic.set("Select ultramafic rock")
640
+ self.var_opt_metamorphic.set("Select metamorphic rock")
641
+ self.var_opt_ore.set("Select ore rock")
642
+
643
+ self.data = self.generate_rock_data(rockname=self.var_opt_volcanic.get())
644
+
645
+ self.container_borehole_lithology[borehole_id][unit_id].set(self.var_opt_volcanic.get())
646
+
647
+ if self.var_opt_volcanic.get() not in self.container_lithology_data:
648
+ self.container_lithology_data[self.var_opt_volcanic.get()] = self.data.copy()
649
+ elif focus == "ultramafic":
650
+ self.var_opt_sedimentary.set("Select sedimentary rock")
651
+ self.var_opt_plutonic.set("Select plutonic rock")
652
+ self.var_opt_volcanic.set("Select volcanic rock")
653
+ self.var_opt_metamorphic.set("Select metamorphic rock")
654
+ self.var_opt_ore.set("Select ore rock")
655
+
656
+ self.data = self.generate_rock_data(rockname=self.var_opt_ultramafic.get())
657
+
658
+ self.container_borehole_lithology[borehole_id][unit_id].set(self.var_opt_ultramafic.get())
659
+
660
+ if self.var_opt_ultramafic.get() not in self.container_lithology_data:
661
+ self.container_lithology_data[self.var_opt_ultramafic.get()] = self.data.copy()
662
+ elif focus == "metamorphic":
663
+ self.var_opt_sedimentary.set("Select sedimentary rock")
664
+ self.var_opt_plutonic.set("Select plutonic rock")
665
+ self.var_opt_volcanic.set("Select volcanic rock")
666
+ self.var_opt_ultramafic.set("Select ultramafic rock")
667
+ self.var_opt_ore.set("Select ore rock")
668
+
669
+ self.data = self.generate_rock_data(rockname=self.var_opt_metamorphic.get())
670
+
671
+ self.container_borehole_lithology[borehole_id][unit_id].set(self.var_opt_metamorphic.get())
672
+
673
+ if self.var_opt_metamorphic.get() not in self.container_lithology_data:
674
+ self.container_lithology_data[self.var_opt_metamorphic.get()] = self.data.copy()
675
+ elif focus == "ore":
676
+ self.var_opt_sedimentary.set("Select sedimentary rock")
677
+ self.var_opt_plutonic.set("Select plutonic rock")
678
+ self.var_opt_volcanic.set("Select volcanic rock")
679
+ self.var_opt_ultramafic.set("Select ultramafic rock")
680
+ self.var_opt_metamorphic.set("Select metamorphic rock")
681
+
682
+ self.data = self.generate_rock_data(rockname=self.var_opt_ore.get())
683
+
684
+ self.container_borehole_lithology[borehole_id][unit_id].set(self.var_opt_ore.get())
685
+
686
+ if self.var_opt_ore.get() not in self.container_lithology_data:
687
+ self.container_lithology_data[self.var_opt_ore.get()] = self.data.copy()
688
+
689
+ try:
690
+ self.fill_lithology_table(dataset=self.data, categories_long=self.categories)
691
+ except:
692
+ print("Please select first a lithology.")
693
+
694
+ self.update_borehole_table()
695
+
696
+ def update_borehole_table(self):
697
+ if len(self.tv_borehole.get_children()) > 0:
698
+ for item in self.tv_borehole.get_children():
699
+ self.tv_borehole.delete(item)
700
+
701
+ n = 0
702
+ for i in self.list_boreholes:
703
+ if i not in self.container_borehole_lithology:
704
+ self.container_borehole_lithology[i] = {}
705
+ if n == len(self.list_units):
706
+ entries = ["-", "-", "-", "-", "-"]
707
+ self.tv_borehole.insert("", tk.END, values=entries)
708
+ n = 0
709
+ for j in self.list_units:
710
+ if j in self.container_borehole_lithology[i]:
711
+ name = self.container_borehole_lithology[i][j]
712
+ else:
713
+ name = "undefined"
714
+
715
+ if j not in self.container_borehole_lithology[i]:
716
+ self.container_borehole_lithology[i][j] = tk.StringVar()
717
+ self.container_borehole_lithology[i][j].set(name)
718
+
719
+ var_entr_top = self.dict_entr_top[i][j].get()
720
+ var_entr_bottom = self.dict_entr_bottom[i][j].get()
721
+ var_entr_name = self.container_borehole_lithology[i][j].get()
722
+ entries = [i, j, var_entr_top, var_entr_bottom, var_entr_name]
723
+ self.tv_borehole.insert("", tk.END, values=entries)
724
+ n += 1
725
+
726
+ def fill_lithology_table(self, dataset, categories_long):
727
+ borehole_id = self.current_borehole_id
728
+ unit_id = self.current_unit_id
729
+ rockname = self.container_borehole_lithology[borehole_id][unit_id].get()
730
+
731
+ if rockname != "undefined":
732
+ if rockname in self.container_lithology_data:
733
+ dataset = self.container_lithology_data[rockname]
734
+ else:
735
+ dataset = self.generate_rock_data(rockname=rockname)
736
+ self.container_lithology_data[rockname] = dataset
737
+
738
+ if len(self.tv_lithology.get_children()) > 0:
739
+ for item in self.tv_lithology.get_children():
740
+ self.tv_lithology.delete(item)
741
+
742
+ for index, category in enumerate(categories_long):
743
+ entries = [category]
744
+
745
+ if self.categories_short[index] == "vPvS":
746
+ category_short = "vP/vS"
747
+ elif self.categories_short[index] == "v":
748
+ category_short = "nu"
749
+ else:
750
+ category_short = self.categories_short[index]
751
+
752
+ n_digits = 3
753
+
754
+ if rockname == "undefined":
755
+ var_entr_min = round(0, n_digits)
756
+ var_entr_max = round(0, n_digits)
757
+ var_entr_mean = round(0, n_digits)
758
+ var_entr_error = round(0, n_digits)
759
+ else:
760
+ var_entr_min = round(min(dataset[category_short]), n_digits)
761
+ var_entr_max = round(max(dataset[category_short]), n_digits)
762
+ var_entr_mean = round(np.mean(dataset[category_short]), n_digits)
763
+ var_entr_error = round(np.std(dataset[category_short], ddof=1), n_digits)
764
+
765
+ entries.extend([var_entr_min, var_entr_max, var_entr_mean, var_entr_error])
766
+ self.tv_lithology.insert("", tk.END, values=entries)
767
+
768
+ entries = ["-", "-", "-", "-", "-"]
769
+ self.tv_lithology.insert("", tk.END, values=entries)
770
+
771
+ for mineral, data_values in dataset["mineralogy"].items():
772
+ entries = [str(mineral) + str(" (%)")]
773
+
774
+ n_digits = 2
775
+ var_factor = 100
776
+
777
+ if rockname == "undefined":
778
+ var_entr_min = round(0, n_digits)
779
+ var_entr_max = round(0, n_digits)
780
+ var_entr_mean = round(0, n_digits)
781
+ var_entr_error = round(0, n_digits)
782
+ else:
783
+ var_entr_min = round(var_factor*min(data_values), n_digits)
784
+ var_entr_max = round(var_factor*max(data_values), n_digits)
785
+ var_entr_mean = round(var_factor*np.mean(data_values), n_digits)
786
+ var_entr_error = round(var_factor*np.std(data_values, ddof=1), n_digits)
787
+
788
+ entries.extend([var_entr_min, var_entr_max, var_entr_mean, var_entr_error])
789
+ self.tv_lithology.insert("", tk.END, values=entries)
790
+
791
+ entries = ["-", "-", "-", "-", "-"]
792
+ self.tv_lithology.insert("", tk.END, values=entries)
793
+
794
+ for element, data_values in dataset["chemistry"].items():
795
+ entries = [str(element) + str(" (%)")]
796
+
797
+ n_digits = 2
798
+ var_factor = 100
799
+
800
+ if rockname == "undefined":
801
+ var_entr_min = round(0, n_digits)
802
+ var_entr_max = round(0, n_digits)
803
+ var_entr_mean = round(0, n_digits)
804
+ var_entr_error = round(0, n_digits)
805
+ else:
806
+ var_entr_min = round(var_factor*min(data_values), n_digits)
807
+ var_entr_max = round(var_factor*max(data_values), n_digits)
808
+ var_entr_mean = round(var_factor*np.mean(data_values), n_digits)
809
+ var_entr_error = round(var_factor*np.std(data_values, ddof=1), n_digits)
810
+
811
+ entries.extend([var_entr_min, var_entr_max, var_entr_mean, var_entr_error])
812
+ self.tv_lithology.insert("", tk.END, values=entries)
813
+
814
+ if "compounds" in dataset:
815
+ entries = ["-", "-", "-", "-", "-"]
816
+ self.tv_lithology.insert("", tk.END, values=entries)
817
+
818
+ for compound, data_values in dataset["compounds"].items():
819
+ entries = [str(compound) + str(" (%)")]
820
+
821
+ n_digits = 2
822
+ var_factor = 100
823
+
824
+ if rockname == "undefined":
825
+ var_entr_min = round(0, n_digits)
826
+ var_entr_max = round(0, n_digits)
827
+ var_entr_mean = round(0, n_digits)
828
+ var_entr_error = round(0, n_digits)
829
+ else:
830
+ var_entr_min = round(var_factor*min(data_values), n_digits)
831
+ var_entr_max = round(var_factor*max(data_values), n_digits)
832
+ var_entr_mean = round(var_factor*np.mean(data_values), n_digits)
833
+ var_entr_error = round(var_factor*np.std(data_values, ddof=1), n_digits)
834
+
835
+ entries.extend([var_entr_min, var_entr_max, var_entr_mean, var_entr_error])
836
+ self.tv_lithology.insert("", tk.END, values=entries)
837
+
838
+ def export_borehole_data(self):
839
+ if self.list_units.all() != None:
840
+ report_file = filedialog.asksaveasfile(
841
+ mode="w",
842
+ initialfile="Report_Borehole-Data_" + str(len(self.list_boreholes)) + str(len(self.list_units)),
843
+ defaultextension=".csv")
844
+ else:
845
+ report_file = filedialog.asksaveasfile(
846
+ mode="w", initialfile="Report_Borehole-Data", defaultextension=".csv")
847
+
848
+ ## General Data
849
+ report_file.write("REPORT (BOREHOLE DATA)" + "\n")
850
+ report_file.write("\n")
851
+
852
+ ## Geophysical Data
853
+ report_file.write("ROCK DATA" + "\n")
854
+ raw_line = "BOREHOLE;UNIT;SAMPLE;TOP;BOTTOM;"
855
+
856
+ for borehole_id in self.list_boreholes:
857
+ if self.list_units.all() == None:
858
+ list_units = self.dict_indices[borehole_id]
859
+ else:
860
+ list_units = self.list_units
861
+ for unit_id in list_units:
862
+ rockname = self.container_borehole_lithology[borehole_id][unit_id].get()
863
+
864
+ if rockname != "undefined":
865
+ dataset = self.generate_rock_data(rockname=rockname)
866
+ n_samples = len(dataset["rho"])
867
+ else:
868
+ n_samples = 0
869
+
870
+ list_keys = list(dataset.keys())
871
+ list_keys.remove("mineralogy")
872
+ list_keys.remove("chemistry")
873
+
874
+ if "compounds" in list_keys:
875
+ list_keys.remove("compounds")
876
+ if "fluid" in list_keys:
877
+ list_keys.remove("fluid")
878
+ if "phi_true" in list_keys:
879
+ list_keys.remove("phi_true")
880
+
881
+ list_keys = ["POISSON" if item == "nu" else item for item in list_keys]
882
+ list_minerals = list(dataset["mineralogy"].keys())
883
+ list_elements = list(dataset["chemistry"].keys())
884
+ list_compounds = list(dataset["compounds"].keys())
885
+
886
+ for key in list_keys:
887
+ raw_line += str(key)
888
+ raw_line += str(";")
889
+
890
+ for mineral in list_minerals:
891
+ raw_line += str(mineral)
892
+ raw_line += str(";")
893
+
894
+ for element in list_elements:
895
+ raw_line += str(element)
896
+ raw_line += str(";")
897
+
898
+ for compound in list_compounds:
899
+ raw_line += str(compound)
900
+ raw_line += str(";")
901
+
902
+ raw_line += str("\n")
903
+
904
+ report_file.write(raw_line)
905
+
906
+ raw_line = ""
907
+ for index in range(n_samples):
908
+ raw_line = (str(borehole_id) + ";" + str(unit_id) + ";" + str(index + 1) + ";" +
909
+ str(self.dict_entr_top[borehole_id][unit_id].get()) + ";" +
910
+ str(self.dict_entr_bottom[borehole_id][unit_id].get()) + ";")
911
+ for key, values in dataset.items():
912
+ if key in list_keys:
913
+ if key in ["phi", "rho_s", "rho", "vP", "vS", "vP/vS", "K", "G", "E", "GR", "PE"]:
914
+ raw_line += str(round(values[index], 3))
915
+ else:
916
+ raw_line += str(values)
917
+
918
+ raw_line += str(";")
919
+ elif key == "nu":
920
+ raw_line += str(round(values[index], 3))
921
+ raw_line += str(";")
922
+
923
+ for mineral in list_minerals:
924
+ if mineral not in ["Urn"]:
925
+ value = dataset["mineralogy"][mineral][index]
926
+ raw_line += str(round(value, 4))
927
+ raw_line += str(";")
928
+ else:
929
+ raw_line += str(round(value, 6))
930
+ raw_line += str(";")
931
+
932
+ for element, values in dataset["chemistry"].items():
933
+ if element in list_elements:
934
+ if element not in ["U"]:
935
+ raw_line += str(round(values[index], 4))
936
+ raw_line += str(";")
937
+ else:
938
+ raw_line += str(round(values[index], 6))
939
+ raw_line += str(";")
940
+
941
+ if "compounds" in dataset:
942
+ for compound, values in dataset["compounds"].items():
943
+ if compound in list_compounds:
944
+ raw_line += str(round(values[index], 4))
945
+ raw_line += str(";")
946
+
947
+ report_file.write(raw_line + "\n")
948
+
949
+ raw_line = "BOREHOLE;UNIT;SAMPLE;TOP;BOTTOM;"
950
+
951
+ def generate_rock_data(self, rockname):
952
+ n_samples = self.var_entr_parts.get()
953
+
954
+ ## Sedimentary rocks
955
+ # Siliciclastic rocks
956
+ if rockname == "Sandstone":
957
+ dataset = SiliciclasticRocks(fluid="water", actualThickness=0).create_sandstone(
958
+ number=n_samples, porosity=[0.0, 0.3])
959
+ elif rockname == "Conglomerate":
960
+ dataset = SiliciclasticRocks(fluid="water", actualThickness=0).create_conglomerate(
961
+ number=n_samples, porosity=[0.0, 0.3])
962
+ elif rockname == "Siltstone":
963
+ dataset = SiliciclasticRocks(fluid="water", actualThickness=0).create_siltstone(
964
+ number=n_samples, porosity=[0.0, 0.1])
965
+ elif rockname == "Mudstone":
966
+ dataset = SiliciclasticRocks(fluid="water", actualThickness=0).create_mudstone_alt(
967
+ number=n_samples, porosity=[0.0, 0.1])
968
+ elif rockname == "Shale":
969
+ dataset = SiliciclasticRocks(fluid="water", actualThickness=0).create_shale_alt(
970
+ number=n_samples, porosity=[0.0, 0.1])
971
+ elif rockname == "Greywacke (Huckenholz)":
972
+ dataset = SiliciclasticRocks(fluid="water", actualThickness=0).create_greywacke_huckenholz(
973
+ rock="Greywacke", number=n_samples, porosity=[0.0, 0.1])
974
+ # Carbonate rocks
975
+ elif rockname == "Limestone":
976
+ dataset = CarbonateRocks(fluid="water", actualThickness=0).create_limestone(
977
+ number=n_samples, porosity=[0.0, 0.4])
978
+ elif rockname == "Dolostone":
979
+ dataset = CarbonateRocks(fluid="water", actualThickness=0).create_dolostone(
980
+ number=n_samples, porosity=[0.0, 0.3])
981
+ elif rockname == "Marl":
982
+ dataset = CarbonateRocks(fluid="water", actualThickness=0).create_marl(
983
+ number=n_samples, porosity=[0.0, 0.3])
984
+
985
+ ## Igneous rocks (plutonic)
986
+ elif rockname in [
987
+ "Foid-bearing Syenite", "Foid-bearing Monzonite", "Foid-bearing Monzodiorite",
988
+ "Foid-bearing Monzogabbro", "Foid Monzosyenite", "Foid Monzodiorite", "Foid Monzogabbro",
989
+ "Foidolite"]:
990
+ dataset = Plutonic(
991
+ fluid="water", actualThickness=0, dict_output=True,
992
+ porosity=[0.0, 0.1]).create_plutonic_rock_streckeisen(
993
+ rock=rockname, number=n_samples, porosity=[0.0, 0.1], upper_streckeisen=False)
994
+ elif rockname in [
995
+ "Granite", "Granodiorite", "Tonalite", "Gabbro", "Norite", "Diorite", "Monzodiorite", "Monzogabbro",
996
+ "Monzonite", "Syenite", "Granitoid", "Quarzolite"]:
997
+ dataset = Plutonic(
998
+ fluid="water", actualThickness=0, dict_output=True,
999
+ porosity=[0.0, 0.1]).create_plutonic_rock_streckeisen(
1000
+ rock=rockname, number=n_samples, porosity=[0.0, 0.1])
1001
+
1002
+ ## Igneous rocks (volcanic)
1003
+ elif rockname in [
1004
+ "Foid-bearing Trachyte", "Foid-bearing Latite", "Foid-bearing Andesite", "Foid-bearing Basalt",
1005
+ "Phonolite", "Tephrite", "Foidite"]:
1006
+ dataset = Volcanic(
1007
+ fluid="water", actualThickness=0, dict_output=True,
1008
+ porosity=[0.0, 0.1]).create_volcanic_rock_streckeisen(
1009
+ rock=rockname, number=n_samples, upper_streckeisen=False)
1010
+ elif rockname in ["Rhyolite", "Dacite", "Trachyte", "Latite", "Andesite", "Basalt"]:
1011
+ dataset = Volcanic(
1012
+ fluid="water", actualThickness=0, dict_output=True,
1013
+ porosity=[0.0, 0.1]).create_volcanic_rock_streckeisen(rock=rockname, number=n_samples)
1014
+
1015
+ ## Ultramafic rocks
1016
+ elif rockname in [
1017
+ "Orthopyroxenite", "Clinopyroxenite", "Dunite", "Harzburgite", "Wehrlite", "Websterite", "Lherzolite",
1018
+ "Olivine-Websterite", "Olivine-Orthopyroxenite", "Olivine-Clinopyroxenite", "Peridotite", "Pyroxenite"]:
1019
+ dataset = UltraMafic(
1020
+ fluid="water", actualThickness=0, dict_output=True, porosity=[0.0, 0.1]).create_ultramafic_rock(
1021
+ rock=rockname, number=n_samples)
1022
+
1023
+ ## Metamorphic rocks
1024
+ elif rockname == "Felsic Granulite":
1025
+ dataset = GranuliteFacies(fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_granulite(
1026
+ number=n_samples, classification="felsic")
1027
+ elif rockname == "Mafic Granulite":
1028
+ dataset = GranuliteFacies(fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_granulite(
1029
+ number=n_samples, classification="mafic")
1030
+ elif rockname == "Basaltic Greenschist":
1031
+ dataset = GreenschistFacies(
1032
+ fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_greenschist_basaltic_alt(
1033
+ number=n_samples)
1034
+ elif rockname == "Ultramafic Greenschist":
1035
+ dataset = GreenschistFacies(
1036
+ fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_greenschist_ultramafic_alt(
1037
+ number=n_samples)
1038
+ elif rockname == "Pelitic Greenschist":
1039
+ dataset = GreenschistFacies(
1040
+ fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_greenschist_pelitic_alt(
1041
+ number=n_samples)
1042
+ elif rockname == "Greenstone":
1043
+ dataset = GreenschistFacies(
1044
+ fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_greenstone(
1045
+ number=n_samples)
1046
+ # Amphibolite-Facies
1047
+ elif rockname == "Ortho-Amphibolite":
1048
+ dataset = AmphiboliteFacies(
1049
+ fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_amphibolite_ortho(
1050
+ number=n_samples)
1051
+
1052
+ ## Ore rocks
1053
+ if rockname in [
1054
+ "Itabirite", "Banded Iron Formation", "Compact Hematite", "Friable Hematite", "Goethite Hematite",
1055
+ "Al-rich Itabirite", "Compact Quartz Itabirite", "Friable Quartz Itabirite", "Goethite Itabirite"]:
1056
+ dataset = OreRocks(fluid="water", actual_thickness=0, porosity=[0.0, 0.1]).create_siliciclastic_itabirite(
1057
+ rock=rockname, number=n_samples)
1058
+
1059
+ ## Evaporite rocks
1060
+
1061
+ return dataset
1062
+
1063
+ def load_drilling_data(self):
1064
+ filename = filedialog.askopenfilenames(
1065
+ parent=self.parent,
1066
+ filetypes=(("csv files", "*.csv"), ("txt files", "*.txt"), ("all files", "*.*")), initialdir=os.getcwd())
1067
+
1068
+ df = pd.read_csv(filename[0])
1069
+ borehole_indices = self.get_borehole_indices(dataset=df["BOREHOLE"])
1070
+ helper_indices = {}
1071
+ for borehole_id in borehole_indices:
1072
+ list_indices = self.get_borehole_id_indices(dataset=df["BOREHOLE"], value=borehole_id)
1073
+ helper_indices[borehole_id] = list_indices
1074
+
1075
+ self.list_units = None
1076
+ self.dict_indices = helper_indices
1077
+
1078
+ if len(self.tv_borehole.get_children()) > 0:
1079
+ for item in self.tv_borehole.get_children():
1080
+ self.tv_borehole.delete(item)
1081
+
1082
+ n = 0
1083
+ for i in borehole_indices:
1084
+ if i not in self.container_borehole_lithology:
1085
+ self.container_borehole_lithology[i] = {}
1086
+ if i not in self.dict_entr_top:
1087
+ self.dict_entr_top[i] = {}
1088
+ if i not in self.dict_entr_bottom:
1089
+ self.dict_entr_bottom[i] = {}
1090
+ for j in helper_indices[i]:
1091
+ if j in self.container_borehole_lithology[i]:
1092
+ name = self.container_borehole_lithology[i][j]
1093
+ else:
1094
+ name = "undefined"
1095
+
1096
+ if j not in self.container_borehole_lithology[i]:
1097
+ self.container_borehole_lithology[i][j] = tk.StringVar()
1098
+ self.container_borehole_lithology[i][j].set(name)
1099
+ if j not in self.dict_entr_top:
1100
+ self.dict_entr_top[i][j] = tk.StringVar()
1101
+ if j not in self.dict_entr_bottom:
1102
+ self.dict_entr_bottom[i][j] = tk.StringVar()
1103
+
1104
+ var_entr_top = df["TOP"].iloc[j]
1105
+ var_entr_bottom = df["BOTTOM"].iloc[j]
1106
+ var_entr_name = df["LITHOLOGY"].iloc[j]
1107
+
1108
+ rockname = self.convert_name(name=var_entr_name)
1109
+ self.container_borehole_lithology[i][j].set(rockname)
1110
+ self.dict_entr_top[i][j].set(round(var_entr_top, 1))
1111
+ self.dict_entr_bottom[i][j].set(round(var_entr_bottom, 1))
1112
+ entries = [i, j, "{:.1f}".format(var_entr_top), "{:.1f}".format(var_entr_bottom), rockname]
1113
+ self.tv_borehole.insert("", tk.END, values=entries)
1114
+ n += 1
1115
+
1116
+ if n == len(helper_indices[i]):
1117
+ entries = ["-", "-", "-", "-", "-"]
1118
+ self.tv_borehole.insert("", tk.END, values=entries)
1119
+ n = 0
1120
+
1121
+ def get_borehole_indices(self, dataset):
1122
+ """Creates a list containing the unique numbers of a given input list.
1123
+ Arguments
1124
+ dataset, list : contains the data.
1125
+ Outputs
1126
+ borehole_indices, list : contains a list of the unique numbers of the given input list
1127
+ """
1128
+ unique_numbers = dataset.unique()
1129
+ borehole_indices = unique_numbers.tolist()
1130
+ self.list_boreholes = borehole_indices
1131
+
1132
+ return borehole_indices
1133
+
1134
+ def get_borehole_id_indices(self, dataset, value):
1135
+ list_indices = dataset.index[dataset == value].tolist()
1136
+
1137
+ return list_indices
1138
+
1139
+ def convert_name(self, name):
1140
+ if name in ["BIF", "bif"]:
1141
+ rockname = "Banded Iron Formation"
1142
+ elif name in ["GSB", "GS", "gsb", "gs"]:
1143
+ rockname = "Greenstone"
1144
+
1145
+ return rockname