Scope warning suppression to avoid globally silencing warnings - #696
Merged
Merged
Conversation
warnings.filterwarnings("ignore") at import time in ensembleseries.py
and warnings.simplefilter('ignore') in Series.spectral/wavelet/
wavelet_coherence mutated the global warnings filter state and never
restored it, permanently silencing all Python warnings for the rest
of the session after a single verbose=False call. This also caused
wavelet_coherence to silently swallow its own warning about
reinterpolating data onto a common time axis.
Suppression is now scoped with warnings.catch_warnings() around just
the underlying numerical computation, and the common_time()
reinterpolation notice is raised as a new DataConformationWarning to
mark it as a warning that should always reach the user regardless of
verbose.
Fixes #695
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
khider
approved these changes
Aug 14, 2026
khider
left a comment
Member
There was a problem hiding this comment.
Approving this as a I agree that we shouldn't be hiding that we are doing this but the question I have is why we are doing it in the first place. If the method requires evenly spaced data, we should raise an error and suggest the use of interp().
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.
warnings.filterwarnings("ignore")at import time in ensembleseries.py and warnings.simplefilter('ignore') in Series.spectral/wavelet/ wavelet_coherence mutated the global warnings filter state and never restored it, permanently silencing all Python warnings for the rest of the session after a singleverbose=Falsecall. This also causedwavelet_coherenceto silently swallow its own warning about interpolating data onto a common time axis.This fix now restricts suppression within
warnings.catch_warnings()around the relevant numerical computations, and thecommon_time()interpolation notice is raised as a new DataConformationWarning to mark it as a warning that should always reach the user regardless of verbose.Fixes #695