rock-physics-open 0.0__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.

Potentially problematic release.


This version of rock-physics-open might be problematic. Click here for more details.

Files changed (142) hide show
  1. rock_physics_open/__init__.py +0 -0
  2. rock_physics_open/equinor_utilities/__init__.py +0 -0
  3. rock_physics_open/equinor_utilities/anisotropy.py +162 -0
  4. rock_physics_open/equinor_utilities/classification_functions/__init__.py +17 -0
  5. rock_physics_open/equinor_utilities/classification_functions/class_stats.py +58 -0
  6. rock_physics_open/equinor_utilities/classification_functions/lin_class.py +47 -0
  7. rock_physics_open/equinor_utilities/classification_functions/mahal_class.py +56 -0
  8. rock_physics_open/equinor_utilities/classification_functions/norm_class.py +65 -0
  9. rock_physics_open/equinor_utilities/classification_functions/poly_class.py +40 -0
  10. rock_physics_open/equinor_utilities/classification_functions/post_prob.py +26 -0
  11. rock_physics_open/equinor_utilities/classification_functions/two_step_classification.py +46 -0
  12. rock_physics_open/equinor_utilities/conversions.py +10 -0
  13. rock_physics_open/equinor_utilities/gen_utilities/__init__.py +11 -0
  14. rock_physics_open/equinor_utilities/gen_utilities/dict_to_float.py +33 -0
  15. rock_physics_open/equinor_utilities/gen_utilities/dim_check_vector.py +83 -0
  16. rock_physics_open/equinor_utilities/gen_utilities/filter_input.py +126 -0
  17. rock_physics_open/equinor_utilities/gen_utilities/filter_output.py +78 -0
  18. rock_physics_open/equinor_utilities/machine_learning_utilities/__init__.py +14 -0
  19. rock_physics_open/equinor_utilities/machine_learning_utilities/dummy_vars.py +42 -0
  20. rock_physics_open/equinor_utilities/machine_learning_utilities/exponential_model.py +119 -0
  21. rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.py +61 -0
  22. rock_physics_open/equinor_utilities/machine_learning_utilities/run_regression.py +151 -0
  23. rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +188 -0
  24. rock_physics_open/equinor_utilities/snapshot_test_utilities/__init__.py +10 -0
  25. rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +145 -0
  26. rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py +54 -0
  27. rock_physics_open/equinor_utilities/std_functions/__init__.py +43 -0
  28. rock_physics_open/equinor_utilities/std_functions/backus_ave.py +53 -0
  29. rock_physics_open/equinor_utilities/std_functions/dvorkin_nur.py +69 -0
  30. rock_physics_open/equinor_utilities/std_functions/gassmann.py +140 -0
  31. rock_physics_open/equinor_utilities/std_functions/hashin_shtrikman.py +195 -0
  32. rock_physics_open/equinor_utilities/std_functions/hertz_mindlin.py +43 -0
  33. rock_physics_open/equinor_utilities/std_functions/moduli_velocity.py +51 -0
  34. rock_physics_open/equinor_utilities/std_functions/reflection_eq.py +98 -0
  35. rock_physics_open/equinor_utilities/std_functions/rho.py +59 -0
  36. rock_physics_open/equinor_utilities/std_functions/voigt_reuss_hill.py +128 -0
  37. rock_physics_open/equinor_utilities/std_functions/walton.py +38 -0
  38. rock_physics_open/equinor_utilities/std_functions/wood_brie.py +77 -0
  39. rock_physics_open/equinor_utilities/various_utilities/Equinor_logo.gif +0 -0
  40. rock_physics_open/equinor_utilities/various_utilities/Equinor_logo.ico +0 -0
  41. rock_physics_open/equinor_utilities/various_utilities/__init__.py +24 -0
  42. rock_physics_open/equinor_utilities/various_utilities/display_result_statistics.py +83 -0
  43. rock_physics_open/equinor_utilities/various_utilities/gassmann_dry_mod.py +37 -0
  44. rock_physics_open/equinor_utilities/various_utilities/gassmann_mod.py +37 -0
  45. rock_physics_open/equinor_utilities/various_utilities/gassmann_sub_mod.py +53 -0
  46. rock_physics_open/equinor_utilities/various_utilities/hs_average.py +40 -0
  47. rock_physics_open/equinor_utilities/various_utilities/pressure.py +88 -0
  48. rock_physics_open/equinor_utilities/various_utilities/reflectivity.py +85 -0
  49. rock_physics_open/equinor_utilities/various_utilities/timeshift.py +91 -0
  50. rock_physics_open/equinor_utilities/various_utilities/vp_vs_rho_set_statistics.py +154 -0
  51. rock_physics_open/equinor_utilities/various_utilities/vrh_3_min.py +61 -0
  52. rock_physics_open/fluid_models/__init__.py +9 -0
  53. rock_physics_open/fluid_models/brine_model/__init__.py +5 -0
  54. rock_physics_open/fluid_models/brine_model/brine_properties.py +143 -0
  55. rock_physics_open/fluid_models/gas_model/__init__.py +5 -0
  56. rock_physics_open/fluid_models/gas_model/gas_properties.py +277 -0
  57. rock_physics_open/fluid_models/oil_model/__init__.py +5 -0
  58. rock_physics_open/fluid_models/oil_model/dead_oil_density.py +60 -0
  59. rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +28 -0
  60. rock_physics_open/fluid_models/oil_model/live_oil_density.py +79 -0
  61. rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +24 -0
  62. rock_physics_open/fluid_models/oil_model/oil_bubble_point.py +69 -0
  63. rock_physics_open/fluid_models/oil_model/oil_properties.py +114 -0
  64. rock_physics_open/sandstone_models/__init__.py +57 -0
  65. rock_physics_open/sandstone_models/cemented_shalysand_sandyshale_models.py +304 -0
  66. rock_physics_open/sandstone_models/constant_cement_models.py +204 -0
  67. rock_physics_open/sandstone_models/constant_cement_optimisation.py +122 -0
  68. rock_physics_open/sandstone_models/contact_cement_model.py +138 -0
  69. rock_physics_open/sandstone_models/curvefit_sandstone_models.py +143 -0
  70. rock_physics_open/sandstone_models/friable_models.py +178 -0
  71. rock_physics_open/sandstone_models/friable_optimisation.py +112 -0
  72. rock_physics_open/sandstone_models/friable_shalysand_sandyshale_models.py +235 -0
  73. rock_physics_open/sandstone_models/patchy_cement_fluid_substitution_model.py +477 -0
  74. rock_physics_open/sandstone_models/patchy_cement_model.py +286 -0
  75. rock_physics_open/sandstone_models/patchy_cement_optimisation.py +251 -0
  76. rock_physics_open/sandstone_models/unresolved_cemented_sandshale_models.py +134 -0
  77. rock_physics_open/sandstone_models/unresolved_friable_sandshale_models.py +126 -0
  78. rock_physics_open/shale_models/__init__.py +19 -0
  79. rock_physics_open/shale_models/dem.py +174 -0
  80. rock_physics_open/shale_models/dem_dual_por.py +61 -0
  81. rock_physics_open/shale_models/kus_tok.py +59 -0
  82. rock_physics_open/shale_models/multi_sca.py +133 -0
  83. rock_physics_open/shale_models/pq.py +102 -0
  84. rock_physics_open/shale_models/sca.py +90 -0
  85. rock_physics_open/shale_models/shale4_mineral.py +147 -0
  86. rock_physics_open/shale_models/shale4_mineral_dem_overlay.py +92 -0
  87. rock_physics_open/span_wagner/__init__.py +5 -0
  88. rock_physics_open/span_wagner/co2_properties.py +438 -0
  89. rock_physics_open/span_wagner/coefficients.py +165 -0
  90. rock_physics_open/span_wagner/equations.py +104 -0
  91. rock_physics_open/span_wagner/tables/__init__.py +0 -0
  92. rock_physics_open/span_wagner/tables/carbon_dioxide_density.npz +0 -0
  93. rock_physics_open/span_wagner/tables/lookup_table.py +33 -0
  94. rock_physics_open/t_matrix_models/Equinor_logo.ico +0 -0
  95. rock_physics_open/t_matrix_models/__init__.py +45 -0
  96. rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +124 -0
  97. rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +124 -0
  98. rock_physics_open/t_matrix_models/curvefit_t_matrix_min.py +86 -0
  99. rock_physics_open/t_matrix_models/opt_subst_utilities.py +415 -0
  100. rock_physics_open/t_matrix_models/parse_t_matrix_inputs.py +297 -0
  101. rock_physics_open/t_matrix_models/run_t_matrix.py +243 -0
  102. rock_physics_open/t_matrix_models/t_matrix_C.py +210 -0
  103. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +137 -0
  104. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +163 -0
  105. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +72 -0
  106. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +86 -0
  107. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +172 -0
  108. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +159 -0
  109. rock_physics_open/t_matrix_models/t_matrix_vector/__init__.py +12 -0
  110. rock_physics_open/t_matrix_models/t_matrix_vector/array_functions.py +75 -0
  111. rock_physics_open/t_matrix_models/t_matrix_vector/calc_c_eff.py +163 -0
  112. rock_physics_open/t_matrix_models/t_matrix_vector/calc_isolated.py +95 -0
  113. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd.py +40 -0
  114. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd_eff.py +116 -0
  115. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd_uuv.py +18 -0
  116. rock_physics_open/t_matrix_models/t_matrix_vector/calc_pressure.py +140 -0
  117. rock_physics_open/t_matrix_models/t_matrix_vector/calc_t.py +71 -0
  118. rock_physics_open/t_matrix_models/t_matrix_vector/calc_td.py +42 -0
  119. rock_physics_open/t_matrix_models/t_matrix_vector/calc_theta.py +43 -0
  120. rock_physics_open/t_matrix_models/t_matrix_vector/calc_x.py +33 -0
  121. rock_physics_open/t_matrix_models/t_matrix_vector/calc_z.py +50 -0
  122. rock_physics_open/t_matrix_models/t_matrix_vector/check_and_tile.py +43 -0
  123. rock_physics_open/t_matrix_models/t_matrix_vector/g_tensor.py +140 -0
  124. rock_physics_open/t_matrix_models/t_matrix_vector/iso_av.py +60 -0
  125. rock_physics_open/t_matrix_models/t_matrix_vector/iso_ave_all.py +55 -0
  126. rock_physics_open/t_matrix_models/t_matrix_vector/pressure_input.py +44 -0
  127. rock_physics_open/t_matrix_models/t_matrix_vector/t_matrix_vec.py +278 -0
  128. rock_physics_open/t_matrix_models/t_matrix_vector/velocity_vti_angles.py +81 -0
  129. rock_physics_open/t_matrix_models/tmatrix_python.dll +0 -0
  130. rock_physics_open/t_matrix_models/tmatrix_python.so +0 -0
  131. rock_physics_open/ternary_plots/__init__.py +3 -0
  132. rock_physics_open/ternary_plots/gen_ternary_plot.py +73 -0
  133. rock_physics_open/ternary_plots/shale_prop_ternary.py +337 -0
  134. rock_physics_open/ternary_plots/ternary_patches.py +277 -0
  135. rock_physics_open/ternary_plots/ternary_plot_utilities.py +197 -0
  136. rock_physics_open/ternary_plots/unconventionals_ternary.py +75 -0
  137. rock_physics_open/version.py +21 -0
  138. rock_physics_open-0.0.dist-info/METADATA +92 -0
  139. rock_physics_open-0.0.dist-info/RECORD +142 -0
  140. rock_physics_open-0.0.dist-info/WHEEL +5 -0
  141. rock_physics_open-0.0.dist-info/licenses/LICENSE +165 -0
  142. rock_physics_open-0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,337 @@
1
+ import numpy as np
2
+ from matplotlib import pyplot as plt
3
+
4
+ from .ternary_plot_utilities import _set_ternary_figure, _triangle_transform
5
+
6
+
7
+ def _shale_prop_ternary(
8
+ quartz,
9
+ carb,
10
+ clay,
11
+ kero,
12
+ phit,
13
+ col_code,
14
+ name_col_code,
15
+ well_name,
16
+ draw_figures=True,
17
+ ):
18
+ """Calculate hardness.
19
+
20
+ Parameters
21
+ ----------
22
+ quartz : np.ndarray
23
+ Quartz volume fraction [fraction].
24
+ carb : np.ndarray
25
+ Carbonate volume fraction [fraction].
26
+ clay : np.ndarray
27
+ Clay volume fraction [fraction].
28
+ kero : np.ndarray
29
+ Kerogen volume fraction [fraction].
30
+ phit : np.ndarray
31
+ Porosity [fraction].
32
+ col_code : np.ndarray
33
+ Property used for colour coding [unknown].
34
+ name_col_code : str
35
+ Plot annotation of log used for colour coding.
36
+ well_name : str
37
+ Plot heading with well name.
38
+
39
+ Returns
40
+ -------
41
+ np.ndarray
42
+ hardness [float].
43
+ """
44
+ KEROMAX = 0.25
45
+
46
+ _, _ = _set_ternary_figure(
47
+ 1, 1, "Hardness vs. Organic Content Ternary Plot", well_name
48
+ )
49
+
50
+ # Define patches
51
+ col = (
52
+ 1
53
+ / 255
54
+ * np.array(
55
+ [
56
+ [
57
+ 208,
58
+ 208,
59
+ 208,
60
+ ],
61
+ [
62
+ 198,
63
+ 198,
64
+ 198,
65
+ ],
66
+ [
67
+ 189,
68
+ 189,
69
+ 189,
70
+ ],
71
+ [
72
+ 179,
73
+ 179,
74
+ 179,
75
+ ],
76
+ [
77
+ 169,
78
+ 169,
79
+ 169,
80
+ ],
81
+ [
82
+ 223,
83
+ 213,
84
+ 203,
85
+ ],
86
+ [
87
+ 214,
88
+ 203,
89
+ 193,
90
+ ],
91
+ [
92
+ 204,
93
+ 194,
94
+ 183,
95
+ ],
96
+ [
97
+ 195,
98
+ 183,
99
+ 174,
100
+ ],
101
+ [
102
+ 187,
103
+ 172,
104
+ 164,
105
+ ],
106
+ [
107
+ 239,
108
+ 218,
109
+ 197,
110
+ ],
111
+ [
112
+ 229,
113
+ 208,
114
+ 188,
115
+ ],
116
+ [
117
+ 221,
118
+ 197,
119
+ 178,
120
+ ],
121
+ [
122
+ 213,
123
+ 186,
124
+ 169,
125
+ ],
126
+ [
127
+ 205,
128
+ 174,
129
+ 159,
130
+ ],
131
+ [
132
+ 254,
133
+ 223,
134
+ 192,
135
+ ],
136
+ [
137
+ 246,
138
+ 211,
139
+ 182,
140
+ ],
141
+ [
142
+ 239,
143
+ 200,
144
+ 173,
145
+ ],
146
+ [
147
+ 231,
148
+ 189,
149
+ 164,
150
+ ],
151
+ [223, 177, 154],
152
+ ]
153
+ )
154
+ )
155
+
156
+ corner_points = np.array(
157
+ [
158
+ [0.00, 0.00],
159
+ [0.25, 0.00],
160
+ [0.25, 0.20],
161
+ [0.00, 0.20],
162
+ ]
163
+ )
164
+
165
+ start_x, start_y = np.meshgrid(
166
+ np.arange(0, 1, 0.25), np.arange(0, 1, 0.2), indexing="ij"
167
+ )
168
+ start_x = start_x.flatten()
169
+ start_y = start_y.flatten()
170
+ vertices = []
171
+ for i in range(len(start_x)):
172
+ vertices.append(corner_points + [start_x[i], start_y[i]])
173
+
174
+ vertices_xy = []
175
+ for i in range(len(vertices)):
176
+ vertices_xy.append(_triangle_transform(vertices[i]))
177
+
178
+ h_p = []
179
+ for i in range(len(vertices)):
180
+ # h_p.append(plt.fill(vertices_xy[i][:,0],vertices_xy[i][:,1],facecolor=col[i,:],edgecolor='k',linewidth=0.5))
181
+ h_p.append(
182
+ plt.fill(vertices_xy[i][:, 0], vertices_xy[i][:, 1], color=col[i, :])
183
+ )
184
+
185
+ # Draw lines around patches
186
+ x = np.array([[0], [1]])
187
+ y = np.array([[0], [0]])
188
+ for i in np.arange(0, 1, 0.2):
189
+ xy = np.column_stack((x, y + i))
190
+ t_xy = _triangle_transform(xy)
191
+ plt.plot(t_xy[:, 0], t_xy[:, 1], "k", linewidth=1)
192
+ x = np.array([[0], [0]])
193
+ y = np.array([[0], [1]])
194
+ for i in np.arange(0, 1.1, 0.25):
195
+ xy = np.column_stack((x + i, y))
196
+ t_xy = _triangle_transform(xy)
197
+ plt.plot(t_xy[:, 0], t_xy[:, 1], "k", linewidth=1)
198
+
199
+ # Annotate axes
200
+ xi = np.linspace(0, 1, 5)
201
+ yi = np.linspace(0, 0.25, 6)
202
+ for j in range(len(xi)):
203
+ plt.text(xi[j], -0.025, "%.2f" % (xi[j]))
204
+ for j in range(len(yi)):
205
+ plt.text(
206
+ 1 - 0.5 / 0.25 * yi[j] + 0.015,
207
+ yi[j] * np.sqrt(3) / 2 / 0.25,
208
+ "%.2f" % (yi[j]),
209
+ )
210
+ handles = []
211
+ # Axes labels
212
+ handles.append(
213
+ plt.text(
214
+ 0.5,
215
+ -0.07,
216
+ "Hardness percentage\nClay+TOC+Phit <== ==> Quartz+Feldspar+Carbonate",
217
+ horizontalalignment="center",
218
+ verticalalignment="center",
219
+ )
220
+ )
221
+ handles.append(
222
+ plt.text(
223
+ 0.95,
224
+ np.sqrt(3) / 4,
225
+ "Organic percentage",
226
+ horizontalalignment="center",
227
+ verticalalignment="center",
228
+ rotation=-62,
229
+ )
230
+ )
231
+ plt.setp(handles, fontname="sans-serif", fontweight="bold", fontsize=11)
232
+
233
+ # Region boundaries
234
+ df = 0.1 * np.array([1, np.tan(np.pi / 6)])
235
+ bb = np.array(
236
+ [
237
+ [1.00, 0.20],
238
+ [1.00, 0.60],
239
+ ]
240
+ )
241
+ bbt = _triangle_transform(bb)
242
+ bet = bbt + df
243
+ for j in range(bb.shape[0]):
244
+ plt.plot(
245
+ [
246
+ bbt[j, 0],
247
+ bet[j, 0],
248
+ ],
249
+ [
250
+ bbt[j, 1],
251
+ bet[j, 1],
252
+ ],
253
+ "k",
254
+ linewidth=0.5,
255
+ )
256
+ df = 0.1 * np.array([-1, np.tan(np.pi / 6)])
257
+ bb = np.array(
258
+ [
259
+ [0.00, 0.20],
260
+ [0.00, 0.60],
261
+ ]
262
+ )
263
+ bbt = _triangle_transform(bb)
264
+ bet = bbt + df
265
+ for j in range(bb.shape[0]):
266
+ plt.plot(
267
+ [
268
+ bbt[j, 0],
269
+ bet[j, 0],
270
+ ],
271
+ [
272
+ bbt[j, 1],
273
+ bet[j, 1],
274
+ ],
275
+ "k",
276
+ linewidth=0.5,
277
+ )
278
+
279
+ # Annotate regions
280
+ names = [
281
+ "Organically lean\nclaystones",
282
+ "Organically rich\nclaystones",
283
+ "Organically dominated\nclaystones",
284
+ "Organically dominated\nmudstones",
285
+ "Organically rich\nmudstones",
286
+ "Organically lean\nmudstones",
287
+ ]
288
+ text_ang = [60, 60, 60, -60, -60, -60]
289
+ text_pos = np.array(
290
+ [
291
+ [0.0, 0.1],
292
+ [0.0, 0.4],
293
+ [0.0, 0.8],
294
+ [1.0, 0.8],
295
+ [1.0, 0.4],
296
+ [1.0, 0.1],
297
+ ]
298
+ )
299
+ text_pos = _triangle_transform(text_pos)
300
+ text_pos = text_pos + np.array(
301
+ [
302
+ [-0.05, 0.0],
303
+ [0.1, 0.05],
304
+ ]
305
+ ).reshape(2, 2).repeat(3, axis=0)
306
+ for i in range(len(names)):
307
+ plt.text(
308
+ text_pos[i, 0],
309
+ text_pos[i, 1],
310
+ names[i],
311
+ horizontalalignment="center",
312
+ verticalalignment="center",
313
+ fontsize=10,
314
+ rotation=text_ang[i],
315
+ )
316
+
317
+ # Calculate the hardness parameter
318
+ soft = clay + kero + phit
319
+ brit = quartz + carb
320
+
321
+ hard = brit / (brit + soft)
322
+
323
+ # Scale kerogen
324
+ kero = np.minimum(kero, KEROMAX)
325
+ kero_scal = kero / KEROMAX
326
+
327
+ data_xy = _triangle_transform(np.column_stack((hard, kero_scal)))
328
+ plt.scatter(data_xy[:, 0], data_xy[:, 1], s=64, c=col_code, zorder=4)
329
+
330
+ hcb = plt.colorbar(pad=0.1)
331
+ hcb.set_label(name_col_code, fontname="sans-serif", fontweight="bold", fontsize=11)
332
+
333
+ # plt.show()<= Show command is issued in controlling class method
334
+ if draw_figures:
335
+ plt.draw()
336
+
337
+ return hard
@@ -0,0 +1,277 @@
1
+ import numpy as np
2
+ from matplotlib import path as pa, pyplot as plt
3
+
4
+ from .ternary_plot_utilities import (
5
+ _make_mesh,
6
+ _set_ternary_figure,
7
+ _ternary_coord_trans,
8
+ )
9
+
10
+
11
+ def _ternary_patches(quartz, carb, clay, kero, well_name, draw_figures=True):
12
+ """Class display of the shale.
13
+
14
+ Parameters
15
+ ----------
16
+ quartz : np.ndarray
17
+ Quartz volume fraction [fraction].
18
+ carb : np.ndarray
19
+ Carbonate volume fraction [fraction].
20
+ clay : np.ndarray
21
+ Clay volume fraction [fraction].
22
+ kero : np.ndarray
23
+ Kerogen volume fraction [fraction].
24
+ well_name : str
25
+ Plot heading with well name.
26
+
27
+ Returns
28
+ -------
29
+ np.ndarray
30
+ Lithology class [int].
31
+ """
32
+ fig, ax = _set_ternary_figure(0, 0, "Lithological Class Ternary Plot", well_name)
33
+
34
+ # Define patches 1 - 16
35
+ names = [
36
+ "Silica-\ndominated\nlithotype",
37
+ "Clay-rich\nsiliceous mudstone",
38
+ "Mixed\nsiliceous\nmudstone",
39
+ "Carbonate-rich\nsiliceous mudstone",
40
+ "Argilaceous/\nsiliceous\nmudstone",
41
+ "Mixed\nmudstone",
42
+ "Carbonate/\nsiliceous\nmudstone",
43
+ "Silica-rich\nargillaceous mudstone",
44
+ "Mixed\nargillaceous\nmudstone",
45
+ "Argillaceous/\ncarbonate\nmudstone\n(marl)",
46
+ "Mixed\ncarbonate\nmudstone",
47
+ "Silica-rich\ncarbonate mudstone",
48
+ "Clay-\ndominated\nlithotype",
49
+ "Carbonate-rich\nargillaceous mudstone",
50
+ "Clay-rich\ncarbonate mudstone",
51
+ "Carbonate-\ndominated\nlithotype",
52
+ ]
53
+ text_ang = [0, 60, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, -60, -60, 0]
54
+ col = (
55
+ 1
56
+ / 255
57
+ * np.array(
58
+ [
59
+ [244, 237, 29],
60
+ [249, 246, 142],
61
+ [255, 230, 137],
62
+ [249, 246, 137],
63
+ [254, 220, 95],
64
+ [222, 238, 197],
65
+ [131, 209, 193],
66
+ [214, 170, 40],
67
+ [197, 166, 114],
68
+ [169, 169, 134],
69
+ [193, 215, 239],
70
+ [150, 180, 218],
71
+ [175, 116, 76],
72
+ [169, 123, 44],
73
+ [96, 149, 202],
74
+ [114, 126, 188],
75
+ ]
76
+ )
77
+ )
78
+
79
+ vertices = [
80
+ np.array(
81
+ [
82
+ [1.0, 0.0, 0.0],
83
+ [0.8, 0.0, 0.2],
84
+ [0.8, 0.2, 0.0],
85
+ ]
86
+ ),
87
+ np.array(
88
+ [
89
+ [0.8, 0.0, 0.2],
90
+ [0.5, 0.0, 0.5],
91
+ [0.5, 0.1, 0.4],
92
+ [0.8, 0.1, 0.1],
93
+ ]
94
+ ),
95
+ np.array(
96
+ [
97
+ [0.8, 0.1, 0.1],
98
+ [0.5, 0.1, 0.4],
99
+ [0.5, 0.4, 0.1],
100
+ ]
101
+ ),
102
+ np.array(
103
+ [
104
+ [0.8, 0.1, 0.1],
105
+ [0.5, 0.4, 0.1],
106
+ [0.5, 0.5, 0.0],
107
+ [0.8, 0.2, 0.0],
108
+ ]
109
+ ),
110
+ np.array(
111
+ [
112
+ [0.5, 0.0, 0.5],
113
+ [0.3, 0.2, 0.5],
114
+ [0.5, 0.2, 0.3],
115
+ ]
116
+ ),
117
+ np.array(
118
+ [
119
+ [0.5, 0.2, 0.3],
120
+ [0.3, 0.2, 0.5],
121
+ [0.2, 0.3, 0.5],
122
+ [0.2, 0.5, 0.3],
123
+ [0.3, 0.5, 0.2],
124
+ [0.5, 0.3, 0.2],
125
+ ]
126
+ ),
127
+ np.array(
128
+ [
129
+ [0.5, 0.3, 0.2],
130
+ [0.3, 0.5, 0.2],
131
+ [0.5, 0.5, 0.0],
132
+ ]
133
+ ),
134
+ np.array(
135
+ [
136
+ [0.5, 0.0, 0.5],
137
+ [0.2, 0.0, 0.8],
138
+ [0.1, 0.1, 0.8],
139
+ [0.4, 0.1, 0.5],
140
+ ]
141
+ ),
142
+ np.array(
143
+ [
144
+ [0.4, 0.1, 0.5],
145
+ [0.1, 0.1, 0.8],
146
+ [0.1, 0.4, 0.5],
147
+ ]
148
+ ),
149
+ np.array(
150
+ [
151
+ [0.0, 0.5, 0.5],
152
+ [0.2, 0.5, 0.3],
153
+ [0.2, 0.3, 0.5],
154
+ ]
155
+ ),
156
+ np.array(
157
+ [
158
+ [0.1, 0.5, 0.4],
159
+ [0.1, 0.8, 0.1],
160
+ [0.4, 0.5, 0.1],
161
+ ]
162
+ ),
163
+ np.array(
164
+ [
165
+ [0.4, 0.5, 0.1],
166
+ [0.1, 0.8, 0.1],
167
+ [0.2, 0.8, 0.0],
168
+ [0.5, 0.5, 0.0],
169
+ ]
170
+ ),
171
+ np.array(
172
+ [
173
+ [0.2, 0.0, 0.8],
174
+ [0.0, 0.0, 1.0],
175
+ [0.0, 0.2, 0.8],
176
+ ]
177
+ ),
178
+ np.array(
179
+ [
180
+ [0.0, 0.2, 0.8],
181
+ [0.0, 0.5, 0.5],
182
+ [0.1, 0.4, 0.5],
183
+ [0.1, 0.1, 0.8],
184
+ ]
185
+ ),
186
+ np.array(
187
+ [
188
+ [0.0, 0.5, 0.5],
189
+ [0.0, 0.8, 0.2],
190
+ [0.1, 0.8, 0.1],
191
+ [0.1, 0.5, 0.4],
192
+ ]
193
+ ),
194
+ np.array(
195
+ [
196
+ [0.0, 0.8, 0.2],
197
+ [0.0, 1.0, 0.0],
198
+ [0.2, 0.8, 0.0],
199
+ ]
200
+ ),
201
+ ]
202
+
203
+ vertices_xy = []
204
+ for i in range(len(vertices)):
205
+ vertices_xy.append(_ternary_coord_trans(vertices[i]))
206
+
207
+ h_p = []
208
+ h_t = []
209
+ for i in range(len(vertices)):
210
+ h_p.append(
211
+ plt.fill(
212
+ vertices_xy[i][:, 0],
213
+ vertices_xy[i][:, 1],
214
+ facecolor=col[i, :],
215
+ edgecolor="k",
216
+ )
217
+ )
218
+ h_t.append(
219
+ plt.text(
220
+ np.mean(vertices_xy[i][:, 0]),
221
+ np.mean(vertices_xy[i][:, 1]),
222
+ names[i],
223
+ horizontalalignment="center",
224
+ verticalalignment="center",
225
+ fontsize=8,
226
+ rotation=text_ang[i],
227
+ )
228
+ )
229
+
230
+ # Make coordinate mesh
231
+ _, _ = _make_mesh(ax)
232
+
233
+ # Annotate the axes
234
+ label_handles = []
235
+ label_handles.append(
236
+ plt.text(0.5, -0.075, "Carbonate", horizontalalignment="center")
237
+ )
238
+ label_handles.append(
239
+ plt.text(
240
+ 0.15,
241
+ np.sqrt(3) / 4 + 0.05,
242
+ "Quartz",
243
+ horizontalalignment="center",
244
+ rotation=60,
245
+ )
246
+ )
247
+ label_handles.append(
248
+ plt.text(
249
+ 0.85,
250
+ np.sqrt(3) / 4 + 0.05,
251
+ "Clay",
252
+ horizontalalignment="center",
253
+ rotation=-60,
254
+ )
255
+ )
256
+ plt.setp(label_handles, fontname="sans-serif", fontweight="bold", fontsize=11)
257
+
258
+ # Plot data
259
+ data_xy = _ternary_coord_trans(quartz, carb, clay)
260
+ plt.scatter(data_xy[:, 0], data_xy[:, 1], s=64, c=kero, zorder=4)
261
+
262
+ # Classification - start at 2001 to match predefined lithology classes in
263
+ startclass = 2000
264
+ lith_class = np.ones(quartz.shape) * np.nan
265
+ for i in range(len(vertices_xy)):
266
+ # class_path = pa.Path(vertices_xy[i], closed=True)
267
+ class_path = pa.Path(vertices_xy[i])
268
+ in_path = class_path.contains_points(data_xy)
269
+ lith_class[in_path] = i + startclass
270
+
271
+ hcb = plt.colorbar()
272
+ hcb.set_label("Kerogen", fontname="sans-serif", fontweight="bold", fontsize=11)
273
+
274
+ # plt.show() <= Show command must be issued from the controlling class method
275
+ if draw_figures:
276
+ plt.draw()
277
+ return lith_class