Skip to content

EnsembleSeries.quantiles(): name common_time() in the mismatched-axes error - #706

Open
vaibhav8a wants to merge 1 commit into
LinkedEarth:masterfrom
vaibhav8a:fix/quantiles-actionable-message
Open

vaibhav8a wants to merge 1 commit into
LinkedEarth:masterfrom
vaibhav8a:fix/quantiles-actionable-message

Conversation

@vaibhav8a

Copy link
Copy Markdown

Fixes #703.

Problem

EnsembleSeries.quantiles(axis='value') requires every member to share a time axis, and correctly refuses rather than silently reshaping the ensemble. But the message doesn't say what to do:

raise ValueError('Time axis not consistent across the ensemble!')

The fix is recorded only in the method's own docstring ("You can use the common_time method to do so"), so a user hitting the error has to go read the docs to find it.

Change

Name common_time() in the error itself:

Time axis not consistent across the ensemble! Apply common_time() first to place all members on a shared time axis.

Message-only — the raise condition and every other path are unchanged.

Testing

Added TestUIEnsembleSeriesQuantiles::test_quantiles_mismatched_time_axes, which builds a two-member ensemble on offset time axes and asserts the ValueError mentions common_time. Confirmed it guards the change: with the ensembleseries.py hunk stashed it fails (the old message doesn't match), and passes with it applied.

pytest pyleoclim/tests/test_core_EnsembleSeries.py — 30 passed.

… error

The axis='value' path already refused rather than reshaping the ensemble,
but the message didn't say what to do about it — the fix was only recorded
in the method's docstring. Name common_time() in the error itself.

Fixes LinkedEarth#703
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.

EnsembleSeries.quantiles(): mismatched-axes error lacks actionable guidance

1 participant