Skip to content

Commit 6cec387

Browse files
committed
Merge branch 'main' into updates
2 parents 8bcc5a8 + 6ef5970 commit 6cec387

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

mtpy/modeling/structured_mesh_3d.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ def to_ws3dinv_intial(self, initial_fn, res_list=None):
26232623
with open(initial_fn, "w") as fid:
26242624
fid.write("".join(lines))
26252625

2626-
self.logger.info(f"Wrote WS3DINV intial model file to: {initial_fn}")
2626+
self._logger.info(f"Wrote WS3DINV intial model file to: {initial_fn}")
26272627

26282628
return initial_fn
26292629

@@ -2769,17 +2769,18 @@ def from_ws3dinv(self, model_fn):
27692769
try:
27702770
lagrange = float(info[8])
27712771
except IndexError:
2772-
self.logger.warning("Did not get Lagrange Multiplier")
2772+
self._logger.warning("Did not get Lagrange Multiplier")
2773+
lagrange = 1.
27732774

27742775
# get lengths of things
27752776
n_north, n_east, n_z, n_res = np.array(
27762777
mlines[1].strip().split(), dtype=int
27772778
)
27782779

27792780
# make empty arrays to put stuff into
2780-
self.nodes_north = np.zeros(n_north)
2781-
self.nodes_east = np.zeros(n_east)
2782-
self.nodes_z = np.zeros(n_z)
2781+
self._nodes_north = np.zeros(n_north)
2782+
self._nodes_east = np.zeros(n_east)
2783+
self.grid_z = np.zeros(n_z + 1)
27832784
self.res_model = np.zeros((n_north, n_east, n_z))
27842785

27852786
# get the grid line locations
@@ -2788,25 +2789,30 @@ def from_ws3dinv(self, model_fn):
27882789
while count_n < n_north:
27892790
mline = mlines[line_index].strip().split()
27902791
for north_node in mline:
2791-
self.nodes_north[count_n] = float(north_node)
2792+
self._nodes_north[count_n] = float(north_node)
27922793
count_n += 1
27932794
line_index += 1
2795+
self.grid_north = np.insert(np.cumsum(self.nodes_north),0,0)
27942796

27952797
count_e = 0 # number of east nodes found
27962798
while count_e < n_east:
27972799
mline = mlines[line_index].strip().split()
27982800
for east_node in mline:
2799-
self.nodes_east[count_e] = float(east_node)
2801+
self._nodes_east[count_e] = float(east_node)
28002802
count_e += 1
28012803
line_index += 1
2804+
self.grid_east = np.insert(np.cumsum(self.nodes_east),0,0)
28022805

28032806
count_z = 0 # number of vertical nodes
2807+
zdep = 0
28042808
while count_z < n_z:
28052809
mline = mlines[line_index].strip().split()
28062810
for z_node in mline:
2807-
self.nodes_z[count_z] = float(z_node)
2811+
self.grid_z[count_z] = zdep
28082812
count_z += 1
2813+
zdep += float(z_node)
28092814
line_index += 1
2815+
self.grid_z[count_z] = zdep
28102816

28112817
# --> get resistivity values
28122818
# need to read in the north backwards so that the first index is

0 commit comments

Comments
 (0)