Skip to content
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

bug: expected fields in evt binary file #2057

Open
martclanor opened this issue Jan 14, 2024 · 0 comments
Open

bug: expected fields in evt binary file #2057

martclanor opened this issue Jan 14, 2024 · 0 comments
Labels
Milestone

Comments

@martclanor
Copy link

martclanor commented Jan 14, 2024

Describe the bug
python version: 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
numpy version: 1.26.2
flopy version: 3.5.0

When creating evt binary files, there seems to be a bug about the mismatch of the data and header in the _build_data_array function of MFFileAccessList.

To Reproduce
As an example, I use the model: https://github.com/modflowpy/flopy/blob/develop/.docs/Notebooks/mf6_simple_model_example.py
If I insert the following evt package before line 190:

evt = flopy.mf6.modflow.mfgwfevt.ModflowGwfevt(
    gwf,
    stress_period_data={
        0: {
            "data": [((0, 0, 0), 5, 0.0004, 1.0, 1.0)],
            "filename": ".evt_bin",
            "binary": True,
        }
    },
    nseg=1,
    maxbound=1,
    surf_rate_specified=True,
)

I get: ValueError: could not assign tuple of length 7 to structure with 8 fields.

Expected behavior
I do not expect this error because when I export evt as a text file ("binary" flag above set to False), it seems to work fine.

Additional context
I tried looking a bit around and saw the following which might be useful:

  • the error is raised in flopy/mf6/data/mffileaccess.py line 1093 when it is attempted to create a numpy array provided the mismatching data and header
return np.array(data_list, dtype=header)
  • header (length = 8)
    image

  • data:
    image

  • data_list (length = 7):
    image

  • Not sure but it seems like pxdp and petm are mistakenly included in the header instead of petm0 (which as an MFDataItemStructure object is set to "optional").

Thanks a lot for taking the time to read this.

@martclanor martclanor added the bug label Jan 14, 2024
@wpbonelli wpbonelli added this to the 3.6.1 milestone Apr 24, 2024
@wpbonelli wpbonelli modified the milestones: 3.6.1, 3.7.0 May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants