Skip to content

Remove WindowedArray backend in favour of ChunkCachedArray - #3096

Draft
fluidnumericsJoe wants to merge 1 commit into
mainfrom
remove-windowed-array
Draft

fluidnumericsJoe wants to merge 1 commit into
mainfrom
remove-windowed-array

Conversation

@fluidnumericsJoe

@fluidnumericsJoe fluidnumericsJoe commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Removes the WindowedArray backend. ChunkCachedArray (FieldSet.to_chunk_cached_arrays()) is now the recommended way to speed up dask-backed FieldSets.

Source

  • Deletes parcels/_core/_windowed_array.py.
  • Removes ModelData.to_windowed_arrays() and the field_data() indirection it needed; Field.data now reads model.data[name] directly.
  • Drops the WindowedArray branch from FieldSet.describe() and from the interpolator type hints.

Deprecation

  • FieldSet.to_windowed_arrays() stays for one release as a deprecated alias. It emits a FutureWarning and calls to_chunk_cached_arrays(), so existing scripts keep a cached backend instead of silently falling back to plain dask. max_levels is accepted but ignored.

Tests

  • Removes tests/test_windowed_array.py. Its dask-vs-NumPy advection parity tests (structured and unstructured grids, forward and backward in time) move to tests/test_backends.py, where they now run for both the Dask and ChunkCachedArray backends.
  • Removes WindowedArray from the backend parametrization in test_backends.py and from test_fieldset_describe_backends.
  • Adds a test for the deprecation stub.

Docs

  • User guides now call to_chunk_cached_arrays() instead of to_windowed_arrays().
  • The "Windowed Arrays" option is removed from the performance guide, and the remaining options are renumbered.

Testing notes

  • Locally, the full suite passes apart from test_fieldset_describe_backends, which fails on the plain-Dask time interval (expects 2000-01-12, gets 2000-01-27). It fails the same way on unmodified main, so it looks like a stale tutorial-data cache on my machine; CI will confirm.
  • tests/test_convert.py was not run locally (xroms missing).
  • The edited notebooks have not been executed yet.

Checklist

  • Tests added
  • This PR targets the correct branch (main for normal development, v3-support for v3 support)

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
    • Describe how you used it (e.g., by pasting your prompt): Claude Code reviewed what needed to come out for the WindowedArray removal, then made the source, test and docs changes and ran the test suite.

[This is Claude Code on behalf of Joe Schoonover]

🤖 Generated with Claude Code

Drop the WindowedArray rolling time-window cache and its plumbing:
- delete parcels._core._windowed_array
- remove ModelData.to_windowed_arrays and the field_data() indirection;
  Field.data now reads model.data directly
- drop the WindowedArray branch from FieldSet.describe and the
  interpolator type hints

FieldSet.to_windowed_arrays() is kept for one release as a deprecated
alias: it emits a FutureWarning and forwards to to_chunk_cached_arrays().
max_levels is accepted but ignored.

Tests: remove test_windowed_array.py, port its dask-vs-numpy advection
parity tests (structured + unstructured, forward + backward) into
test_backends.py for the Dask and ChunkCachedArray backends, and add a
test for the deprecation stub.

Docs: user guides now call to_chunk_cached_arrays(); the Windowed Arrays
option is removed from the performance guide.
for model in self.models:
model.to_windowed_arrays(max_levels=max_levels)
return self
warnings.warn(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikvansebille - I know we talked about potentially just removing this from the public API straight away. Thinking on this a bit and I think redirecting to .to_chunk_cached_arrays() with a warning for the next immediate release is ideal. This gives folks some time to adjust any of their code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, let's keep this as a warning. Perhaps you can add a typing_extensions.deprecated.

See also the last bullet point in https://docs.parcels-code.org/en/latest/development/index.html#code-guidelines

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

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants