From 885310cebb8e65fa9e80ba6c0c044dcdc345d6a3 Mon Sep 17 00:00:00 2001 From: Paul Gierz Date: Tue, 12 May 2026 12:05:53 +0200 Subject: [PATCH 1/2] Silence seawater deprecation warning, document EOS-80 vs TEOS-10 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. --- pyfesom2/climatology.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/pyfesom2/climatology.py b/pyfesom2/climatology.py index f55b00d..f6e7fda 100644 --- a/pyfesom2/climatology.py +++ b/pyfesom2/climatology.py @@ -8,10 +8,43 @@ # Add seasonal climatology ################################################################################ import os +import warnings import numpy as np import scipy as sc -import seawater as sw + +# ============================================================================= +# WARNING: EOS-80 vs TEOS-10 +# ----------------------------------------------------------------------------- +# This module deliberately uses the (deprecated, unmaintained) `seawater` +# library, which implements the EOS-80 equation of state. The successor +# library `gsw` implements TEOS-10, which is the *current* international +# standard (since 2010) for seawater thermodynamics. +# +# We have NOT migrated to gsw on purpose: +# +# * EOS-80 takes Practical Salinity (PSS-78, unitless) as input. +# * TEOS-10 takes Absolute Salinity (g/kg) as input, which differs from +# Practical Salinity by a *regionally varying* composition anomaly that +# gsw retrieves from a bundled lon/lat/depth atlas (`gsw.SA_from_SP`). +# * Climatology inputs here are practical salinity from PHC / WOA, so a +# literal swap would silently change the numbers and break reproducibility +# against legacy pyfesom2 output. +# +# A proper TEOS-10 migration must (1) plumb lon/lat through to compute SA, +# (2) decide whether to use SR (gsw.SR_from_SP) as a global-mean shortcut, +# and (3) accept that potential temperatures will differ slightly from the +# EOS-80 reference. Until that scientific decision is made, we keep EOS-80 +# and just silence the deprecation noise. +# ============================================================================= +with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + message=".*seawater library is deprecated.*", + category=UserWarning, + ) + import seawater as sw # noqa: E402 + from netCDF4 import Dataset from numpy import nanmean From d579505b5307c837f67f7a1a4455395e613d5c49 Mon Sep 17 00:00:00 2001 From: Paul Gierz Date: Tue, 12 May 2026 14:02:50 +0200 Subject: [PATCH 2/2] Fix cache-environment-key typo in CI workflow --- .github/workflows/pyfesom2_onPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pyfesom2_onPR.yml b/.github/workflows/pyfesom2_onPR.yml index 78cdfdf..aabc7a5 100644 --- a/.github/workflows/pyfesom2_onPR.yml +++ b/.github/workflows/pyfesom2_onPR.yml @@ -58,7 +58,7 @@ jobs: with: environment-file: main/ci/requirements-py37.yml environment-name: pyfesom2 - cache-envronment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" + cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" init-shell: >- bash zsh