Skip to content

Commit

Permalink
refactor(dis): removed dis.read_from_cnf() method. (#699)
Browse files Browse the repository at this point in the history
* It's not used.  It's broken.  And it's not tested.
* Closes  #687
  • Loading branch information
langevin-usgs authored Oct 27, 2019
1 parent 20d881b commit a3742dd
Showing 1 changed file with 0 additions and 88 deletions.
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

0 comments on commit a3742dd

Please sign in to comment.