Skip to content

fix: I preserve lazy dataset extrapolation - #633

Open
manduinca wants to merge 2 commits into
pyTMD:mainfrom
manduinca:fix/lazy-extrapolation
Open

manduinca wants to merge 2 commits into
pyTMD:mainfrom
manduinca:fix/lazy-extrapolation

Conversation

@manduinca

@manduinca manduinca commented Oct 22, 2026 •

Copy link
Copy Markdown

Closes #614

I defer extrapolation for Dask-backed datasets until computation and return Dask-backed data variables from interp(..., extrapolate=True). I reuse the existing NN/IDW kernel for eager and delayed execution. A temporary Dataset with separate model/target namespaces lets Dask share the model read with interpolation without aligning unrelated coordinates.

I added regressions for deferred reads, eager/lazy equivalence, a single shared model read through the complete interpolation path, multiple constituents, real/complex data, scalar targets, metadata, and coordinate/name collisions. I also added my name to CONTRIBUTORS.md as requested by the contribution guide.

Validation

  • python -m pytest -o addopts= test/test_dataset_extrap_lazy.py test/test_math.py -q: 35 passed.
  • A standalone processes scheduler check matched the eager result with xr.testing.assert_identical.
  • Ruff checks on the new test, format checks on both changed Python files, and git diff --check: passed.
  • I reproduced the eager-read regression on the original code and the duplicate-read regression before correcting the shared graph.

Coordinates can still be evaluated for cropping. The delayed extrapolation task materializes the cropped model and target and builds a global tree; it does not provide memory bounded by chunk size. I have not tested a distributed cluster or benchmarked a real tide model.

CI follow-up (2026-10-26)

I checked the Windows job: its actual runtime is Python 3.13.5 with pytest 8.4.1. All 20 new lazy-extrapolation cases passed. The four failures occurred while downloading the IERS ocean-pole file: two propagated a connection timeout, and two passed that timeout object to pytest.xfail, which expects a string.

I reproduced the same four failures on both the published head (71ff33a9) and its exact base (60931a4b) using a controlled connection timeout, isolated caches, and pytest 8.4.1. The relevant test, downloader, and workflow files are identical between those revisions. My local run used macOS/Python 3.14.6, so it is not a complete reproduction of the Windows environment. I also reran the 20 lazy regressions and 15 math tests successfully; the main deferred-read regression still fails on the base.

The latest CI for the same head is green: attempt 3 of pytest Build passed on Ubuntu, macOS, and Windows. The four-failure analysis above concerns attempt 2.

I preserve deferred extrapolation while integrating the current main changes.
I validated 46 lazy/math tests, 12 spatial tests and a two-process check
with one shared model read.

This branch has not been deployed

No deployments
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.

Interpolation with extrapolate=True triggers eager evaluation on lazy-loaded inputs

1 participant