diff --git a/flopy/modflow/mf.py b/flopy/modflow/mf.py index 363e4643e4..0dd4eb6e82 100644 --- a/flopy/modflow/mf.py +++ b/flopy/modflow/mf.py @@ -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 diff --git a/flopy/modflow/mfdis.py b/flopy/modflow/mfdis.py index cc1f8a063c..a4cf726655 100644 --- a/flopy/modflow/mfdis.py +++ b/flopy/modflow/mfdis.py @@ -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): diff --git a/flopy/modflow/mfoc.py b/flopy/modflow/mfoc.py index 329e4331f3..eb8762fac1 100644 --- a/flopy/modflow/mfoc.py +++ b/flopy/modflow/mfoc.py @@ -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 diff --git a/flopy/modflow/mfwel.py b/flopy/modflow/mfwel.py index 496d38925d..dc2c2f2af3 100644 --- a/flopy/modflow/mfwel.py +++ b/flopy/modflow/mfwel.py @@ -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: diff --git a/flopy/utils/binaryfile.py b/flopy/utils/binaryfile.py index 88738d5d5c..ea87f1a066 100644 --- a/flopy/utils/binaryfile.py +++ b/flopy/utils/binaryfile.py @@ -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: @@ -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) @@ -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')]