Skip to content

Issue #1952 improve timeseries resampling further - #1955

Merged
ClaireDons merged 14 commits into
masterfrom
issue_#1952-improve-timeseries-resampling-further
Nov 3, 2026
Merged

ClaireDons merged 14 commits into
masterfrom
issue_#1952-improve-timeseries-resampling-further

Conversation

@ClaireDons

@ClaireDons ClaireDons commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1952 , following on from #1953

(Github refuses to let me stack these PRs, I probably did something wrong)

Description

This is needed for porting the MKWELLIPF iMOD5 function properly (Deltares/iMOD-Suite-transition-regional-models#17) but can be useful more generally.

Main change is that a skipna flag was added to resample_timeseries() that skips NaN values and then takes weighted average rather the forward filling values. It's by default False, so default behaviour remains unchanged. While implementing this I also went around and refactored things a little (hopefully for the best). The other change is that if all values are nodata in average_timeseries(), then the rate is set to 0 rather than staying as NaN (which is consistent with iMOD5).

Remaining questions:

  • Do we want this to continue to live in util or should it move somewhere else?
  • Should GroundwaterFlowModel.from_imod5_data and Modflow6Simulation.from_imod5_data expose the flag?

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
  • If feature added: Added feature to API documentation
  • If pixi.lock was changed: Ran pixi run generate-sbom and committed changes

@ClaireDons
ClaireDons marked this pull request as ready for review November 2, 2026 14:25

@JoerivanEngelen JoerivanEngelen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for cleaning this up, and clarifying the code, I think it is much more understandable now. I have 2 comments, one just to ease my mind. Approving in advance!

Comment thread imod/util/expand_repetitions.py Resolved
Comment thread imod/util/expand_repetitions.py Resolved
@ClaireDons
ClaireDons added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@ClaireDons
ClaireDons enabled auto-merge November 3, 2026 14:18
@ClaireDons
ClaireDons added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 3, 2026
@ClaireDons
ClaireDons added this pull request to the merge queue Nov 3, 2026
Merged via the queue into master with commit 9c0f148 Nov 3, 2026
8 checks passed
@ClaireDons
ClaireDons deleted the issue_#1952-improve-timeseries-resampling-further branch November 3, 2026 17:48
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.

[Bug] - resample_timeseries: output shifted by one period when well records exist before the first time

2 participants