Skip to content

L2_correlations: explicit common_time alignment, ERSSTv6, CI fixes - #100

Merged
khider merged 9 commits into
mainfrom
align-policy-697
Nov 16, 2026
Merged

khider merged 9 commits into
mainfrom
align-policy-697

Conversation

@CommonClimate

@CommonClimate CommonClimate commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

In response to LinkedEarth/Pyleoclim_util#711, which deprecates the implicit common_time() alignment in pairwise methods (correlation(), causality(), wavelet_coherence()). When two series have different time axes, those methods now emit a FutureWarning, and Pyleoclim 2.0.0 will raise a ValueError instead.

L2_correlations.ipynb

  • Explicit alignment. The six correlation() calls on records with different time axes now pass common_time_kwargs={}. This keeps the previous behavior (interpolation) without the warning, and also works on Pyleoclim 1.3.1.
  • Plain-English explanation. A new markdown cell after the first call explains:
    • why two records must share a time axis before they can be correlated;
    • what common_time_kwargs={} means;
    • what common_time() does with its default settings: it keeps the period both records cover, builds an evenly spaced axis with the average spacing, and fills it by linear interpolation;
    • how to choose another method.
  • ERSSTv5 → ERSSTv6 (Huang et al., 2025). The grid and coordinate order are the same as v5; the record starts in 1850 instead of 1854. The notebook was re-run, and the p-values and FDR percentages quoted in the text were updated to match.
  • Fallback for NOAA outages. The THREDDS cell has a commented-out line that switches to a local copy of the data. The NOAA server was rate-limited and then down while this PR was being prepared.

The re-run also uses the fix for LinkedEarth/Pyleoclim_util#712, whose statsmodels ConvergenceWarnings used to flood the output of the field correlation.

Other changes

  • data/ersstv6_tropical_pacific.nc (6 MB) is the tropical Pacific subset the notebook falls back on, generated by data/make_ersstv6_subset.py. *.nc is gitignored, so .gitignore gets an explicit exception for this one file.
  • Kernelspec check: the new workflow check-kernelspec.yml fails any PR in which a notebook declares a kernel other than python3, because a custom name such as pyleo breaks nbmake and readers' Jupyter. Notebooks with no kernelspec pass. Run python .github/scripts/check_kernelspec.py --fix to repair a notebook locally.
  • CI: ubuntu-latest runners no longer bundle Miniconda, so both conda workflows now set miniforge-version: latest, and sync_jupyterbook.yml moves from setup-miniconda@v2 to v3. environment.yml replaces defaults with nodefaults, because Anaconda's channels now require accepting their terms of service in CI.

Notes for reviewers

  • The notebook no longer declares a kernelspec (the local re-run had set it to pyleo, which CI doesn't have), so it runs on the default Python kernel of whatever environment opens it.
  • L2_wavelet_analysis was checked and needs no change: its wavelet_coherence() call uses method='wwz', which does no alignment.

🤖 Generated with Claude Code

CommonClimate and others added 5 commits November 12, 2026 18:27
Pyleoclim now emits a FutureWarning when correlation() silently puts two
series with different time axes onto a common one; this will raise a
ValueError in Pyleoclim 2.0.0 (LinkedEarth/Pyleoclim_util#697). Pass
common_time_kwargs={} to the six correlation() calls, which keeps the
current behavior (interpolation) and works on Pyleoclim 1.3.1 too, and
explain the choice where it first appears.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ubuntu-latest runner images no longer bundle Miniconda, which
setup-miniconda relies on unless told to install one. Add
miniforge-version: latest to both workflows (and move
sync_jupyterbook from v2 to v3). Replace the defaults channel with
nodefaults: Anaconda's defaults now require ToS acceptance in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add a markdown cell after the first correlation() call explaining, in
  plain English, why the records must share a time axis, what
  common_time_kwargs={} does, what common_time() does with its default
  settings, and how to choose another method. Links to the docs.
  Replaces the shorter note added before the call.
- Use NOAA ERSSTv6 instead of v5 (URL, variable names, labels, text),
  citing Huang et al. (2025), doi:10.1175/JCLI-D-23-0707.1. Same grid
  and coordinate order as v5; the record starts in 1850 instead of 1854.
- In the THREDDS cell, add a commented-out fallback to a local copy of
  the data for when the NOAA server is unavailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Saves the region and period L2_correlations uses to
data/ersstv6_tropical_pacific.nc, so the notebook can fall back on it
when the NOAA THREDDS server is rate-limited or down. The data file
itself is not included yet: run the script once the server is up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fresh outputs from a clean run against Pyleoclim master (with #711 and
the #712 AR(1) fit fix merged). Update the p-values and FDR percentages
quoted in the text to match ERSSTv6, and add a pointer to Hu et al.
(2017) on when the FDR correction matters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

CommonClimate and others added 4 commits November 16, 2026 11:27
The notebook asked for a kernel named "pyleo", which exists only on the
machine it was last run on, so CI (nbmake) and other users could not
find it. Without a kernelspec, Jupyter uses the default Python kernel
of whatever environment runs the notebook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copying all global attributes from the THREDDS dataset included
'_NCProperties', which netCDF reserves, so to_netcdf() failed with
"NetCDF: String match to name in use". Copy only attributes whose names
do not start with an underscore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated with data/make_ersstv6_subset.py from NOAA PSL THREDDS on
2026-11-16: monthly SST, 15N-15S, 140E-280E, 1850-01 to 2026-10
(6 MB). The notebook can load it when the THREDDS server is down.
*.nc files are gitignored, so add an explicit exception for this one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A notebook saved from a custom kernel (e.g. "pyleo") records that name,
which no other machine has, so nbmake and readers' Jupyter fail to start
it. The new workflow runs .github/scripts/check_kernelspec.py on PRs and
pushes that touch notebooks: it fails, with a file annotation, on any
kernelspec whose name is not "python3" (none at all is fine: Jupyter
then uses the default python3 kernel). Run the script with --fix to
repair notebooks locally; it edits only the kernelspec block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CommonClimate
CommonClimate requested a review from khider November 16, 2026 20:03
@khider
khider merged commit 40fc651 into main Nov 16, 2026
2 checks passed
@khider
khider deleted the align-policy-697 branch November 16, 2026 20:51
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.

2 participants