-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError reading head file #801
Comments
What program wrote the head file? Only MODFLOW 6 is double precision by default. Also you need to use a version of MODFLOW that creates true binary files (no fortran headers). MODFLOW 6 and windows versions of MODFLOW from the USGS website are correctly configured. You can also get versions with the correct binary file format from: https://github.com/MODFLOW-USGS/executables/releases Also, it probably isn't ideal to use If you could, it would be nice to add this as question on stack overflow once we resolve it. |
I'm using the mflgr_double.exe that originated here (in the bin.zip) https://water.usgs.gov/GIS/metadata/usgswrd/XML/sir2019-5052.xml I'm running the 2050y_lgr model using the batch file that was provided. In the parent model I modified the output control to save specific sp/ts. Are you familiar with this model/exe? Thanks for the note re: get_alldata(). I've used this in the past without any performance issues. Thank you for your help. |
I am not familiar with that specific executable but I suspect the problem is a result of the binary file header format type. Currently there isn't a double-precision version of mflgr in the windows executables zipfile on github. There are double-precision linux and osx versions of mflgr on github. If you need that particular version of mflgr you will have to compile it for yourself if you want it to work with flopy. |
Thanks for taking a look. I stopped the model so that the hds file would be smaller to test whether or not the file size was the issue. The partial run hds file is less than half a gig. It looks like the nrow/ncol are correct however a huge number is being read for nlay. See below:
Does that confirm your suspicion re: binary file header format type? Thanks, John |
Probably. Please try the executable in the attached zip file. |
The exe you provided results in the following: MODFLOW-LGR2 RUNNING MODFLOW WITH LGR Using NAME file: ../2050y_child/child4_projmedDmedS.nam mflgrdbl.exe 00007FF6D55915FB GWF2MNW27AD 1868 gwf2mnw27.f I recompiled the modified source code for the USGS model (found in the above links). File "C:\Anaconda\lib\site-packages\flopy\utils\datafile.py", line 476, in get_alldata This is slightly different from the previous error I was seeing. |
Not sure why the executable I provided is not working. Since you can compile the source code on your end, replace openspec.inc in your source directory with the attached file. This modified file will create the correct header information in binary output files. I would delete your existing head and binary budget file before running your recompiled executable. |
Thanks for sending that over. Using that file makes the exe very slow. Program received signal SIGSEGV: Segmentation Backtrace for this error: *replaced pound sign with - so as to not link to other issues |
That file should not have any effect on run times since it just changes the output header information. It could be an issue with the optimization you are using with your compiler. I don't have any idea why there a segfault in your compiled version of the code. Could be a difference between the compiler used to compile the original version of the executable and your compiler ( If you want to compile the code yourself from the source files in the model repository, you could uncomment I have compiled and attached a single- (mflgr.exe) version of MODFLOW-LGR2 for you. It was compiled with the Intel fortran ( At this point this is no longer a flopy issue. You will need to reach out to the authors of the model for further assistance if the attached executables don't work for you. |
Thank you for all of your help. The exe you provided runs, but ends before the first stress period finishes with I've reached out to the authors of the model. I'll close this issue. Thanks! |
Not sure if this is an error or a question for Stack Overflow. Please advise if SO is the better place and I'll remove this issue.
I'm getting the following error while trying to extract records from a head file.
flopy is installed in C:\Anaconda\lib\site-packages\flopy
Traceback (most recent call last):
File "read_mdl.py", line 20, in
recs = hdobj.get_alldata()
File "C:\Anaconda\lib\site-packages\flopy\utils\datafile.py", line 476, in get_alldata
h = self.get_data(totim=totim, mflay=mflay)
File "C:\Anaconda\lib\site-packages\flopy\utils\datafile.py", line 438, in get_data
data = self._get_data_array(totim1)
File "C:\Anaconda\lib\site-packages\flopy\utils\datafile.py", line 343, in _get_data_array
data = np.empty((self.nlay, nrow, ncol), dtype=self.realtype)
ValueError: array is too big;
arr.size * arr.dtype.itemsize
is larger than the maximum possible size.The file is fairly large, 1.73 GB. The model is 9 layers, ~300 rows, ~150 cols. I'm saving ~500 time steps.
I'm calling the function here:
hdobj = flopy.utils.HeadFile(h_file,precision='double')
recs = hdobj.get_alldata()
trying to look at the time steps in the file seems like it's returning junk:
If I exclude precision:
Error. Precision could not be determined for heads_cut_test.hds
Traceback (most recent call last):
File "", line 1, in
File "C:\Anaconda\lib\site-packages\flopy\utils\binaryfile.py", line 450, in init
raise Exception()
Exception
I'm using flopy v3.2.11, Python 3.7.1 (64-bit), and my machine has 32 GB RAM installed.
Thanks!
The text was updated successfully, but these errors were encountered: