Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Forward filling packages from_imod5_data #1439

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

Closed
JoerivanEngelen opened this issue Feb 19, 2025 · 1 comment Β· Fixed by #1550
Closed

Forward filling packages from_imod5_data #1439

JoerivanEngelen opened this issue Feb 19, 2025 · 1 comment Β· Fixed by #1550
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JoerivanEngelen
Copy link
Contributor

We just ran into the following:

  • The projectfile had a single datetime record 1900-01-01 for the CHD package.
  • times = [np.datetime64("2018-01-01"), np.datetime64("2020-01-01")] was provided to Modflow6Simulation.from_imod5_data(...)
  • The simulation returned a model with the CHD package at 1900-01-01, in spite of the times provided
  • He resorted to calling simulation.clip_box(time_min = times[0]), which clipped the CHD package away entirely.
  • Confused user, where did the CHD package go?

iMOD5 would forward fill these packages. iMOD Python currently forward fills well timeseries, but doesn't forward fill grid packages. I think clip_box did the right thing here, but from_imod5_data could forward fill these packages.

Quite a common usecase is a CHD package defined every 14 days in the projectfile, and then starting a model somewhere in between those 14 days. In that case the last CHD before the simulation start should be taken.

@JoerivanEngelen JoerivanEngelen added the enhancement New feature or request label Feb 19, 2025
@github-project-automation github-project-automation bot moved this to πŸ“― New in iMOD Suite Feb 19, 2025
@JoerivanEngelen JoerivanEngelen changed the title [FEATURE] - Forward filling packages from_imod5_data Forward filling packages from_imod5_data Feb 28, 2025
@JoerivanEngelen
Copy link
Contributor Author

I investigated this further: it turns out Package.clip_box should forward fill the time coordinate, so I don't know what happened there. We could make a call to Package.clip_box in this case.

@JoerivanEngelen JoerivanEngelen added this to the v1.0 release milestone Jun 3, 2025
@JoerivanEngelen JoerivanEngelen self-assigned this Jun 3, 2025
@JoerivanEngelen JoerivanEngelen moved this from πŸ“― New to πŸ— In Progress in iMOD Suite Jun 3, 2025
JoerivanEngelen added a commit that referenced this issue Jun 4, 2025
Fixes #1439

# Description
- Refactor: Move duplicate set_repeat_stress logic to separate utility
function
- Refactor: Move CHD cells from imod5 data logic to separate utility
function
- Add call to clip_box with time_min and time_max in boundary condition
packages from_imod5_data method to properly forward time.
- Change signatures of Recharge.from_imod5_data and
ConstantHead.from_imod5_data to also allow a call to clip_box
- Type annotate return type ``Self`` of clip_box, as this is the way
since python 3.11 to avoid having to cast or overload the return type
when ``clip_box`` is called in a method in a child class.

# Checklist
<!---
Before requesting review, please go through this checklist:
-->

- [x] Links to correct issue
- [ ] Update changelog, if changes affect users
- [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737``
- [x] Unit tests were added
- [ ] **If feature added**: Added/extended example
@github-project-automation github-project-automation bot moved this from πŸ— In Progress to βœ… Done in iMOD Suite Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: βœ… Done
Development

Successfully merging a pull request may close this issue.

1 participant