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

Issue #1316 msw model from imod5 data #1328

Conversation

JoerivanEngelen
Copy link
Contributor

@JoerivanEngelen JoerivanEngelen commented Dec 9, 2024

Fixes #1316

Description

Adds MetaSwapModel.from_imod5_data, currently only models can be written by turning off validation, that is still something to pick up.

  • Adds MetaSwapModel.from_imod5_data
  • Converts Imod5DataDict TypeAlias to TypedDict, with which we can avoid a lot of type casting.
  • Add masking and broadcasting utilities for MetaSWAP iMOD5 data. I could not easily make calls to the MODFLOW6 utilities for masking, as these assumed presence of a layer coordinate and had logic to deal with that, which is irrelevant for MetaSWAP.
  • Adds MetaSwapActive dataclass to store masks
  • Allow user-defined settings upon initialization, instead of only supporting default settings.
  • Add validate argument to MetaSwapModel.write to turn off model validation upon writing.

Checklist

  • Links to correct issue
  • Update changelog, if changes affect users
  • PR title starts with Issue #nr, e.g. Issue #737
  • Unit tests were added
  • If feature added: Added/extended example

docs/api/msw.rst Show resolved Hide resolved
imod/msw/infiltration.py Outdated Show resolved Hide resolved
"""
extra_paths = imod5_data["extra"]["paths"]
path_to_parasim = find_in_file_list("para_sim.inp", extra_paths)
parasim_settings = read_para_sim(path_to_parasim)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if path_to_parasim is empty? Should this be put in an if statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All iMOD5 usecases contain this file in the "EXTRA" section in the projectfile: Without it they couldn't run their MetaSWAP model with iMOD5. If the para_sim.inp is missing an error will be thrown: "could not find para_sim.inp in list of paths: ..."

imod/msw/utilities/parse.py Show resolved Hide resolved
imod/msw/utilities/parse.py Outdated Show resolved Hide resolved
imod/tests/test_msw/test_infiltration.py Show resolved Hide resolved
Copy link

sonarcloud bot commented Dec 12, 2024

@JoerivanEngelen JoerivanEngelen merged commit bec1beb into issue_#1260_from_imod5_data_metaswap Dec 12, 2024
6 of 7 checks passed
@JoerivanEngelen JoerivanEngelen deleted the issue_#1316_msw_model_from_imod5_data branch December 12, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants