Skip to content

Improve concat: test coverage, duplicate timestamp validation, match/case#957

Open
ecomodeller wants to merge 2 commits intomainfrom
test/concat-keep-coverage
Open

Improve concat: test coverage, duplicate timestamp validation, match/case#957
ecomodeller wants to merge 2 commits intomainfrom
test/concat-keep-coverage

Conversation

@ecomodeller
Copy link
Copy Markdown
Member

@ecomodeller ecomodeller commented Mar 31, 2026

Summary

  • Adds unit tests verifying overlap values for keep='first' and keep='last' in generic.concat with dfs0 files
  • Adds integration test using sorted(glob(...)) to reproduce the #956 workflow
  • Rejects datasets with duplicate timestamps (e.g. DA diagnostic output) with a clear error instead of cryptic pandas cannot reindex on an axis with duplicate labels
  • Uses match/case for the keep parameter to catch invalid values like typos
  • Removes dead hasattr(self, "time") check and stale comments

The concat logic is correct — glob() returns files in arbitrary order, which is the likely root cause of #956. The workaround is sorted(glob(...)).

Closes #956

Addresses #956 — the concat logic is correct but requires chronologically
sorted input. Added tests verifying overlap values for both keep modes,
including an integration test using glob + sorted to match the reported
workflow.
- Reject datasets with duplicate timestamps (e.g. DA diagnostic output)
  with a clear error instead of cryptic pandas reindex failure
- Use match/case for keep parameter to catch invalid values
- Remove dead hasattr/time check and stale comments
@ecomodeller ecomodeller changed the title Add test coverage for concat keep='first'/'last' with dfs0 Improve concat: test coverage, duplicate timestamp validation, match/case Apr 1, 2026
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.

mikeio.generic.concat first/last not working

1 participant