Silence seawater deprecation#239
Merged
Merged
Conversation
The seawater library is deprecated in favor of gsw (TEOS-10) but a literal swap is not safe: gsw expects Absolute Salinity (g/kg) while this module receives Practical Salinity from PHC/WOA, and the SA<->SP conversion is regionally varying. Until a deliberate scientific decision is made on TEOS-10 migration, keep EOS-80 numerics and just silence the import-time warning. Prominent comment block records why. Verified seawater still works on Python 3.13 + numpy 2.4.x.
koldunovn
approved these changes
May 12, 2026
Contributor
|
I've seen this one so many times :) |
Member
Author
|
I'm still going to get the tests to pass (they are unrelated to anything here, just some infra hiccups in conda I think) It might be worthwhile to bump up the Pyfesom2 version number, what do you think @JanStreffing? |
…r-deprecation # Conflicts: # .github/workflows/pyfesom2_onPR.yml
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
The
seawaterlibrary prints aUserWarning: The seawater library is deprecated! Please use gsw instead.on everypyfesom2import. This PR silences that warning at the only site that imports it (pyfesom2/climatology.py) and adds a prominent block comment explaining why a migration togswis not happening at this time.Why not migrate to gsw?
seawater.ptmpexpects Practical Salinity (PSS-78).gsw.pt0_from_texpects Absolute Salinity (g/kg).gsw.SA_from_SP(SP, p, lon, lat)does a regionally varying lookup against a bundled atlas — a literal swap would silently change the numerics.A real TEOS-10 migration is a scientific decision, not a mechanical refactor, and is deferred until that decision is made.
Compatibility check
Verified that
seawaterstill runs on Python 3.13 + numpy 2.4.3 in a clean container (sw.ptmpreturns sensible values), so silencing rather than removing is safe for the foreseeable future.Test plan
python -c "import pyfesom2"no longer prints the seawater deprecation warningNot a sensible test, nothing touches this codepyfesom2.climatology.climatology(<phc_file>)still produces identical potential-temperature output