Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions flopy/modflow/mf.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,17 @@ def load(f, version='mf2k', exe_name='mf2005.exe',
print ext_unit_dict
for key, item in ext_unit_dict.iteritems():
if item.package is not None:
pck = item.package.load(item.filename, ml, ext_unit_dict=ext_unit_dict)
pass
try:
pck = item.package.load(item.filename, ml, ext_unit_dict=ext_unit_dict)
except BaseException as o:
print "[WARNING] - Exception loading {!s} file: {!s}".format(item.filetype, o)
elif "data" not in item.filetype.lower():
if verbose:
print "skipping package", item.filetype, item.filename
elif "data" in item.filetype.lower():
ml.external_fnames.append(item.filename)
ml.external_units.append(key)
ml.external_binflag.append("binary" in item.filetype.lower())
return ml


Expand Down
2 changes: 1 addition & 1 deletion flopy/modflow/mfdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_cell_volumes(self):
"""
vol = np.empty((self.nlay, self.nrow, self.ncol))
for l in range(self.nlay):
vol[l,:, :] *= self.get_thickness()[l]
vol[l, :, :] *= self.thickness.array[l]
for r in range(self.nrow):
vol[:, r, :] *= self.delc[r]
for c in range(self.ncol):
Expand Down
2 changes: 1 addition & 1 deletion flopy/modflow/mfoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def load(f, model, nper=None, ext_unit_dict=None):
#process each line
for line in f:
lnlst = line.strip().split()
if line[0] is '#':
if line[0] == '#':
continue

# added by JJS 12/12/14 to avoid error when there is a blank line in the OC file
Expand Down
2 changes: 1 addition & 1 deletion flopy/modflow/mfwel.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def write_file(self):
f_wel.write('%s\n' % self.heading)
line = (' {0:9d} {1:9d}'.format(self.stress_period_data.mxact, self.ipakcb))

if self.specify and self.parent.version is 'mfnwt':
if self.specify and self.parent.version == 'mfnwt':
f_wel.write('SPECIFY {0:10.5g} {1:10d}\n'.format(self.phiramp, self.phiramp_unit))

for opt in self.options:
Expand Down
10 changes: 5 additions & 5 deletions flopy/utils/binaryfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class binaryheader():
"""
def __init__(self, bintype=None, precision='single'):
floattype = 'f4'
if precision is 'double':
if precision == 'double':
floattype = 'f8'
self.header_types = ['head','ucn']
if bintype is None:
Expand Down Expand Up @@ -173,9 +173,9 @@ def __init__(self, filename, precision, verbose):
self.recordarray = []
self.iposarray = []

if precision is 'single':
if precision == 'single':
self.realtype = np.float32
elif precision is 'double':
elif precision == 'double':
self.realtype = np.float64
else:
raise Exception('Unknown precision specified: ' + precision)
Expand Down Expand Up @@ -463,11 +463,11 @@ def __init__(self, filename, precision='single', verbose=False):
h1dt = [('kstp', 'i4'), ('kper', 'i4'), ('text', 'a16'),
('ncol', 'i4'), ('nrow', 'i4'), ('nlay', 'i4')]

if precision is 'single':
if precision == 'single':
self.realtype = np.float32
h2dt = [('imeth', 'i4'), ('delt', 'f4'), ('pertim', 'f4'),
('totim', 'f4')]
elif precision is 'double':
elif precision == 'double':
self.realtype = np.float64
h2dt = [('imeth', 'i4'),('delt', 'f8'), ('pertim', 'f8'),
('totim', 'f8')]
Expand Down