Skip to content

feat: add loco support#198

Open
nils3er wants to merge 1 commit into
mainfrom
loco
Open

feat: add loco support#198
nils3er wants to merge 1 commit into
mainfrom
loco

Conversation

@nils3er

@nils3er nils3er commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

feat: follow live datasets that stream one timestep at a time

Summary

Adds support for live datasets — a Zarr store whose time axis is fully declared up front, but where only the currently-available timestep can be fetched at any moment. This lets Gridlook follow a running simulation or a rolling forecast, jumping to and re-rendering each new timestep as the model produces it.

Enable it by appending ::live=true to the dataset URL:

https://gridlook.pages.dev/#<ZARR_URI>::live=true

How it works

When live mode is active, Gridlook:

  1. Seeds the initial time index from a current-timestep endpoint, so the very first render requests a chunk that actually exists (bounded by a 10s timeout; best-effort — the follow loop recovers on its own if it fails).
  2. Long-polls a next-timestep endpoint and, whenever a newer timestep is reported, writes it into the time slider — which the existing grid loader already watches — triggering a refetch and re-render.
  3. Locks the time slider (only one timestep is fetchable at a time) and swaps the playback controls for a LIVE badge with a pause/resume button. Pausing freezes the current frame; resuming jumps back to the newest timestep.
  4. Reconnects with exponential backoff (1s → 30s cap) on network drops or 5xx, showing a subtle "Reconnecting…" indicator until the connection recovers.

Live mode is HTTP-only (Zarr FetchStore); Icechunk stores are not supported. The live time index is deliberately kept out of the shareable URL, since it's re-seeded from the server on load.

Server contract

The data server must expose two endpoints as siblings of the store root, each returning { "timestep": <index> }:

Endpoint Behaviour
current-timestep Responds immediately with the index available right now
next-timestep Long-polls; responds only once a newer timestep is ready

Full details in docs/live-datasets.md.

Changes

  • New src/lib/data/liveTimestep.ts — endpoint helpers plus LiveTimestepController, which drives the fetch-current-then-long-poll loop with backoff and abort handling.
  • New src/store/useLiveTimestep.ts — Vue composable wiring the controller into the store, starting/stopping it as live/pause state and the datasource change.
  • Store — new live / livePaused / liveConnected / liveTimestep state and actions; live URL param plumbed through paramStore and urlParams.
  • UIDimensionControl.vue shows the LIVE badge + pause/resume and disables manual time scrubbing; useTimeAnimation.ts disables playback for live datasets; GlobeView.vue seeds the initial timestep on load.
  • Teststests/unit/lib/data/liveTimestep.test.ts covers URL joining, payload parsing/validation, HTTP-only detection, and the controller's emit-current-then-follow / stop-before-start behaviour.
  • Docs — new docs/live-datasets.md; README pointer.

Incidental: more robust HEALPix nside detection

Healpix.vue's getNside() was refactored into a clear fallback chain — healpix_nside on the CRS variable → dggs.refinement_level on the group → inferring from a global grid's cell count (ncells = 12 · nside²) — with a descriptive error when none apply. This makes grid rendering more resilient for stores that don't carry an explicit healpix_nside.

Notes

  • package-lock.json churn is metadata only (devOptionaldev reclassification of platform-specific optional deps).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploying gridlook with  Cloudflare Pages  Cloudflare Pages

Latest commit: 460d9fc
Status: ✅  Deploy successful!
Preview URL: https://af1a44f0.gridlook.pages.dev
Branch Preview URL: https://loco.gridlook.pages.dev

View logs

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