Skip to content

Stream frame interpolation for lazy DataArrays#28

Merged
CyrilJl merged 4 commits into
mainfrom
lazy-frame-streaming
Jul 4, 2026
Merged

Stream frame interpolation for lazy DataArrays#28
CyrilJl merged 4 commits into
mainfrom
lazy-frame-streaming

Conversation

@CyrilJl

@CyrilJl CyrilJl commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rework animate() so it no longer materializes the full dataset (da.values) or the temporally upsampled array — frames are interpolated on the fly by a generator holding at most two source frames, and dispatched lazily to the worker pool.
  • Add a streaming counterpart to color-scale normalization (_norm_streaming) that aggregates per-frame quantiles instead of computing them over the full 3D array, and skips the data pass entirely when vmin/vmax/norm are already provided. Same treatment applied to quiver animations.
  • Measured peak RAM on a 512 MB lazily-opened netCDF: 2.7 GB → 205 MB.
  • Add pooch to the test optional-dependency group for the new lazy-loading tests.

Test plan

  • pytest tests/test_lazy.py
  • Full test suite: pytest
  • Manually run an animation against a large lazily-opened netCDF and confirm RAM stays low

CyrilJl and others added 4 commits July 4, 2026 11:17
animate() no longer materializes the full dataset (da.values) nor the
upsampled array. Frames are interpolated on the fly by a generator that
holds at most two source frames, and dispatched lazily to the worker
pool. Quantile-based color scaling streams per-frame percentiles for
non-numpy inputs and skips the data pass entirely when vmin/vmax/norm
are provided. Same treatment for quiver animations.

Peak RAM on a 512 MB lazily-opened netCDF: 2.7 GB -> 205 MB.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Needed for pooch-backed sample dataset fetching used by the new lazy-frame streaming tests.
The mamba-solved conda-forge environment pinned an incompatible
rasterio/libjxl pair (ImportError: libjxl.so.0.11), breaking test
collection. Installing everything from PyPI wheels via uv sidesteps
conda-forge's binary pinning entirely (rasterio/pyogrio/pyproj wheels
bundle their own GDAL/GEOS/PROJ), and is much faster to boot. ffmpeg
is a system binary, not a Python package, so it's still installed
separately via apt.
Ubuntu's system Python is PEP 668 externally-managed, so
`uv pip install --system` refuses to touch it. uv sync creates an
isolated project venv instead, sidestepping that restriction.
@CyrilJl CyrilJl merged commit 65ece5c into main Jul 4, 2026
2 checks passed
@CyrilJl CyrilJl deleted the lazy-frame-streaming branch July 4, 2026 21:40
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.

1 participant