Require explicit item and z_item on vertical classes#659
Open
ecomodeller wants to merge 2 commits into
Open
Conversation
Raise ValueError on duplicate (time, z) entries instead of silently deduplicating. Vertical profiles must have a unique depth per timestamp; duplicates indicate a data-quality issue that the caller should resolve before construction, not a sampling artifact the library should paper over.
…elResult Drops the positional defaults (`z_item=0`, `item=None` with 2-column auto-pick). A vertical profile's depth axis and value column are the defining inputs; defaulting them to "column 0" / "column 1" is a position-based assumption in an API that should be name-based. The same flaw exists on TrackObservation and TrackModelResult but those have real users and will get a separate deprecation PR; vertical is alpha and can break cleanly. Internal transforms (`sel`, `trim`, etc.) reach the constructors via the base `_create_new_instance` which calls `self.__class__(data)` with no kwargs. Two overrides reconstruct `item` from `self.name` and use `z_item="z"` (always renamed by the parser), preserving the prevalidated- dataset path without leaking sentinel defaults into the public signature. Two other internal call sites that bypassed `_create_new_instance` (`comparison/_comparison.py` and `comparison/_vertical_comparison.py`) now go through it for consistency. Also fixes a docstring typo (`mikeio.Dfs0, mikeio.Dfs0` -> `mikeio.Dfs0, mikeio.Dataset`) and switches both data-arg docstrings from type-listing to semantic description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Drops the defaults
z_item=0anditem=None-with-2-column-auto-pick onVerticalObservationandVerticalModelResult. Both arguments become required.