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

Error in reading drawdown file #93

Closed flydream0428 closed 8 years ago

flydream0428 commented 8 years ago

Hi Guys, Does the current release support drawdown file reading? I can read binary head files, but with drawdown, I received the following message. I have tried this on different models. "Traceback (most recent call last): File "", line 254, in run_nodebug File "C:\Project\Arrow_Project\t4_NSMC_60_models\NSMC_PRE_NO_CSG\test_ddn.py", line 7, in hdobj = fp.utils.HeadFile('NSMC_PRE_NO_CSG.ddn',precision='single') File "C:\Anaconda2\lib\site-packages\flopy\utils\binaryfile.py", line 325, in init super(HeadFile, self).init(filename, precision, verbose, kwargs) File "C:\Anaconda2\lib\site-packages\flopy\utils\binaryfile.py", line 160, in init super(BinaryLayerFile, self).init(filename, precision, verbose, kwargs) File "C:\Anaconda2\lib\site-packages\flopy\utils\datafile.py", line 118, in init self._build_index() File "C:\Anaconda2\lib\site-packages\flopy\utils\binaryfile.py", line 178, in _build_index header = self._get_header() \ File "C:\Anaconda2\lib\site-packages\flopy\utils\binaryfile.py", line 212, in _get_header return header[0] IndexError: index 0 is out of bounds for axis 0 with size 0"**

The code I use is below.

%% load head data

hdobj = fp.utils.HeadFile('NSMC_PRE_NO_CSG.ddn',precision='single')

layer 1

arr_0 = hdobj.get_alldata(mflay=0)

jtwhite79 commented 8 years ago

try: hdobj = fp.utils.HeadFile('NSMC_PRE_NO_CSG.ddn',precision='single', text="drawdown")

flydream0428 commented 8 years ago

Thanks Jeremy :+1: