Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dis): removed dis.read_from_cnf() method. #699

Merged
merged 1 commit into from
Oct 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions flopy/modflow/mfdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,94 +533,6 @@ def get_layer(self, i, j, elev):
"""
return get_layer(self, i, j, elev)

def read_from_cnf(self, cnf_file_name, n_per_line=0):
"""
Read discretization information from an MT3D configuration file.

"""

def getn(ii, jj):
if (jj == 0):
n = 1
else:
n = int(ii / jj)
if (ii % jj != 0):
n = n + 1

return n

try:
f_cnf = open(cnf_file_name, 'r')

# nlay, nrow, ncol
line = f_cnf.readline()
s = line.split()
cnf_nlay = int(s[0])
cnf_nrow = int(s[1])
cnf_ncol = int(s[2])

# ncol column widths delr[c]
line = ''
for dummy in range(getn(cnf_ncol, n_per_line)):
line = line + f_cnf.readline()
cnf_delr = [float(s) for s in line.split()]

# nrow row widths delc[r]
line = ''
for dummy in range(getn(cnf_nrow, n_per_line)):
line = line + f_cnf.readline()
cnf_delc = [float(s) for s in line.split()]

# nrow * ncol htop[r, c]
line = ''
for dummy in range(getn(cnf_nrow * cnf_ncol, n_per_line)):
line = line + f_cnf.readline()
cnf_top = [float(s) for s in line.split()]
cnf_top = np.reshape(cnf_top, (cnf_nrow, cnf_ncol))

# nlay * nrow * ncol layer thickness dz[l, r, c]
line = ''
for dummy in range(
getn(cnf_nlay * cnf_nrow * cnf_ncol, n_per_line)):
line = line + f_cnf.readline()
cnf_dz = [float(s) for s in line.split()]
cnf_dz = np.reshape(cnf_dz, (cnf_nlay, cnf_nrow, cnf_ncol))

# # read cinact and cdry
# # values are not used by dis so are not read
# line = f_cnf.readline()
# s = line.split()
# cinact, cdry = float(s[0]), float(s[1])

# close the MT3D configuration file
f_cnf.close()
finally:
self.nlay = cnf_nlay
self.nrow = cnf_nrow
self.ncol = cnf_ncol

self.delr = Util2d(model, (self.ncol,), np.float32, cnf_delr,
name='delr', locat=self.unit_number[0])
self.delc = Util2d(model, (self.nrow,), np.float32, cnf_delc,
name='delc', locat=self.unit_number[0])
self.top = Util2d(model, (self.nrow, self.ncol), np.float32,
cnf_top, name='model_top',
locat=self.unit_number[0])

cnf_botm = np.empty((self.nlay + sum(self.laycbd), self.nrow,
self.ncol))

# First model layer
cnf_botm[0:, :, :] = cnf_top - cnf_dz[0, :, :]
# All other layers
for l in range(1, self.nlay):
cnf_botm[l, :, :] = cnf_botm[l - 1, :, :] - cnf_dz[l, :, :]

self.botm = Util3d(model, (self.nlay + sum(self.laycbd),
self.nrow, self.ncol), np.float32,
cnf_botm, 'botm',
locat=self.unit_number[0])

def gettop(self):
"""
Get the top array.
Expand Down