modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
517 stars 313 forks source link

CellBudgetFile byte count off #177

Closed aleaf closed 7 years ago

aleaf commented 7 years ago

While reading the attached file, flopy appears to have the wrong byte count for iface records, resulting in the following error:

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-3-a2a3f9248c0a> in <module>()
      2 sys.path.append('/Users/aleaf/Documents/GitHub/flopy3/')
      3 import flopy.utils.binaryfile as bf
----> 4 cbobj = bf.CellBudgetFile('LAK_visualization_7TS.cbb')

/Users/aleaf/Documents/GitHub/flopy3/flopy/utils/binaryfile.py in __init__(self, filename, precision, verbose, **kwargs)
    480 
    481         # read through the file and build the pointer index
--> 482         self._build_index()
    483 
    484         # allocate the value array

/Users/aleaf/Documents/GitHub/flopy3/flopy/utils/binaryfile.py in _build_index(self)
    566 
    567             # skip over the data to the next record and set ipos
--> 568             self._skip_record(header)
    569             ipos = self.file.tell()
    570 

/Users/aleaf/Documents/GitHub/flopy3/flopy/utils/binaryfile.py in _skip_record(self, header)
    607                               naux * self.realtype(1).nbytes)
    608         else:
--> 609             raise Exception('invalid method code ' + str(imeth))
    610         if nbytes != 0:
    611             self.file.seek(nbytes, 1)

Exception: invalid method code 1086324736

I tried looking in the MODFLOW manual for documentation about how iface is written to cell budget output but couldn't find anything.

LAK_visualization_7TS.cbb.zip

langevin-usgs commented 7 years ago

@aleaf, couple quick thoughts. Are you writing compact budget with aux? You need the following in the output control file: COMPACT BUDGET AUX If you do this, then IFACE will be written as a float to the budget file, and flopy should be able to read it.

Does MODPATH work with this file?

langevin-usgs commented 7 years ago

@aleaf, seems like we can close this.