Add type hints and tests for therm_inert.py#40
Open
spencerahill wants to merge 1 commit into
Open
Conversation
Annotate all six public functions in therm_inert.py with ArrayLike/float signatures (Roadmap 003 Group 5) and add puffins.therm_inert to the mypy strict overrides. Add test_therm_inert.py with 26 tests covering known values, physical limiting cases (damping -> 0/1, phase lag -> pi/2 / 0), and scalar/ndarray/DataArray input handling (Roadmap 004 Phase 5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
First PR in the Tier-A autonomous queue (mechanical type hints + self-verifying tests). Pairs Roadmap 003 (type hints) and Roadmap 004 (testing) for
therm_inert.py.ArrayLike/floatsignatures, following thethermodynamics.pypattern (cast(ArrayLike, ...)on returns per the xarray-mypy house rule).puffins.therm_inertto the mypy strict overrides inpyproject.toml.test_therm_inert.py(26 tests): known values, physical limiting cases (damping → 0/1, phase lag → π/2 / 0, τ ∝ T⁻³), latitude-symmetry cancellation of the annual-cycle term, and scalar/ndarray/DataArray input handling.Verification
mypy puffins/therm_inert.py: clean (only the pre-existing, unrelatedbudget_adj.py:69error remains).-W error::RuntimeWarning.ruff check/ruff format: clean.Tests are self-verifying (limiting behavior and internal algebraic identities), so no external paper-value lookups were needed — this stays firmly Tier A.
🤖 Generated with Claude Code