-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatua.py
149 lines (127 loc) · 6.16 KB
/
Patua.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# %%
import sys
sys.path.append('/Volumes/GoogleDrive/My Drive/GemPhy/GP_old/')
sys.path.append('/Volumes/GoogleDrive/My Drive/')
import gempy as gp
from GemPhy.Geophysics.utils.util import constant64
from gempy.core.tensor.modeltf_var import ModelTF
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# %%
class PutuaModel():
def __init__(self, resolution = [50,50,50]) -> None:
self.P = {}
self.P['HypP'] = {}
self.P['HypP']['jupyter'] = False
self.P['HypP']['ErrorType'] = 'Global'
self.P['DataTypes'] = ['Grav']
self.P['xy_origin']=[318000,4379246, 1200-4000]
self.P['xy_extent'] = [7000,9000,4000]
# self.P['xy_extent'] = [9000,9400,4000]
# Define the model limits
self.P['xmin'] = self.P['xy_origin'][0]
self.P['xmax'] = self.P['xy_origin'][0]+self.P['xy_extent'][0]
self.P['ymin'] = self.P['xy_origin'][1]
self.P['ymax'] = self.P['xy_origin'][1]+self.P['xy_extent'][1]
self.P['zmin'] = self.P['xy_origin'][2]
self.P['zmax'] = self.P['xy_origin'][2]+self.P['xy_extent'][2]
data_path = './Data/'
self.geo_data = gp.create_data( extent=[self.P['xmin'], self.P['xmax'], self.P['ymin'], self.P['ymax'], self.P['zmin'], self.P['zmax']], resolution=resolution,
path_o=data_path + "Patua_orientations.csv",
path_i=data_path + "Patua_surface_points.csv")
gp.map_series_to_surfaces(self.geo_data, {"Intrusion": 'intrusion',
"Fault_Series1": 'fault1',
"Fault_Series2": 'fault2',
"Fault_Series3": 'fault3',
"Fault_Series4": 'fault4',
"Fault_Series5": 'fault5',
"Fault_Series6": 'fault6',
"Fault_Series7": 'fault7',
"Fault_Series8": 'fault8',
"Fault_Series9": 'fault9',
"Fault_Series10": 'fault10',
"Fault_Series11": 'fault11',
"Fault_Series12": 'fault12',
"Sedimentary_Series": ('Sedimentary',
'Volcanic_mafic','Volconic_felsic'),
"Basement":'basement'
}
)
# order_series = ['Intrusion',
# 'Fault_Series1',
# 'Fault_Series2',
# 'Fault_Series3',
# 'Fault_Series4',
# 'Fault_Series5',
# 'Fault_Series6',
# 'Fault_Series7',
# 'Fault_Series8',
# 'Fault_Series9',
# 'Fault_Series10',
# 'Fault_Series11',
# 'Fault_Series12',
# 'Sedimentary_Series',
# 'Basement']
# self.geo_data.reorder_series(order_series)
self.geo_data.set_is_fault(['Fault_Series1',
'Fault_Series2',
'Fault_Series3',
'Fault_Series4',
'Fault_Series5',
'Fault_Series6',
'Fault_Series7',
'Fault_Series8',
'Fault_Series9',
'Fault_Series10',
'Fault_Series11',
'Fault_Series12',
])
# Anisotropy, apply z direction extension to model intrusion
mapping_object = {"Fault_Series1":np.array([1,1,1]),
"Fault_Series2":np.array([1,1,1]),
"Fault_Series3":np.array([1,1,1]),
"Fault_Series4":np.array([1,1,1]),
"Fault_Series5": np.array([1,1,1]),
"Fault_Series6":np.array([1,1,1]),
"Fault_Series7":np.array([1,1,1]),
"Fault_Series8": np.array([1,1,1]),
"Fault_Series9": np.array([1,1,1]),
"Fault_Series10":np.array([1,1,1]),
"Fault_Series11":np.array([1,1,1]),
"Fault_Series12":np.array([1,1,1]),
"Intrusion":np.array([1,1,0.01]),
"Sedimentary_Series": np.array([1,1,1]),
}
gp.assign_global_anisotropy(self.geo_data,mapping_object)
# TODO: very hacky way to modify the order
self.geo_data.modify_order_surfaces(2,0) # Put order 2 to index 1
self.geo_data.modify_order_surfaces(3,0) # Put order 1 to index 1
# assign densities to the model, fault series with -1
self.geo_data.add_surface_values([2.9,
-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1, -1,
2.1,
2.2,
2.3,
2.8], 'densities')
## Initialize the model
def init_model(self):
model = ModelTF(self.geo_data)
model.activate_regular_grid()
model.create_tensorflow_graph(gradient = False)
return model
# %%
if __name__ == "__main__":
P = PutuaModel()
# %%
model = P.init_model()
gp._plot.plot_3d(model, show_lith = False)
# %%
model.compute_model()
# %%
gp._plot.plot_3d(model)
# %%
cross_section = gp.plot.plot_section(model, cell_number=25,
direction='y',show_grid=True, show_data=True)
cross_section.fig.savefig('./Fig/model_nosmooth.png',dpi = 400)
# %%