Skip to content

fix(examples): declare the ECMWF grid node-registered - #862

Merged
kylebarron merged 1 commit into
mainfrom
kyle/ecmwf-node-registration
Nov 6, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/ecmwf-node-registration

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

The dynamical-zarr-ecmwf example drew the ECMWF grid 0.125° east and 0.125° south of where it belongs. Its hand-written GeoZarr metadata now declares "spatial:registration": "node".

The store's coordinate arrays put each value on its grid point: latitude runs from 90 to -90 and longitude from -180 to 179.75, matching the transform's origin of (-180, 90) and step of 0.25°. With the default pixel registration, that origin was read as the corner of the top-left cell instead of its centre, so every cell sat half a cell east and south. With node registration, ZarrLayer draws each cell centred on its grid point. The comment's ranges now give the grid points: [-180, 179.75] and [90, -90].

The grid's edge cells now reach 0.125° past the poles and past -180°. On Web Mercator the mesh stops at ±85.05° anyway, and on the globe #858 clamps it to the poles. There's no seam at the antimeridian.

The zarr-globe example in #794 reads the same grid, and gets the same change there.

Screenshots

At lead time 0 of the latest run, with the control panel hidden.

Sardinia, zoom 7: the island's cooler cells move west and north onto the island.

PLACEHOLDER: drop sardinia-before-after.png here (before on the left, after on the right)

Fiji, by the antimeridian, zoom 6: the warmer cells move onto Viti Levu, and there's no seam at 180°.

PLACEHOLDER: drop fiji-before-after.png here (before on the left, after on the right)

Tests

  • Example-only change, no new tests. The workspace typecheck, the example build and Biome pass.
  • Checked in Chrome: the example's initial view over Europe, Sardinia at zoom 7, and the antimeridian by Fiji at zoom 6, before and after.

🤖 Written by Claude Code

The store's coordinates put each value on its grid point: latitude 90 to
-90 and longitude -180 to 179.75. With the default pixel registration,
the transform's origin was the corner of the top-left cell, so the grid
drew 0.125° east and south of where it belongs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the fix label Nov 6, 2026
kylebarron added a commit that referenced this pull request Nov 6, 2026
Its coordinates put each value on its grid point, so with pixel
registration the grid drew 0.125° east and south of where it belongs.
Same change as dynamical-zarr-ecmwf's in #862.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

✅

@kylebarron
kylebarron merged commit 7608f11 into main Nov 6, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/ecmwf-node-registration branch November 6, 2026 17:00
kylebarron added a commit that referenced this pull request Nov 6, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

The globe-view prototype (#563) added a COG globe example, but nothing
showed the Zarr path on a globe. This adds `examples/zarr-globe`, which
animates ECMWF's AIFS Single 2 m temperature forecast on MapLibre's
globe projection with deck.gl interleaved. It's the
`dynamical-zarr-ecmwf` example on a globe, but reads a different
forecast so that the whole visible half of the globe loads quickly. The
shared globe render path already handles `ZarrLayer`, so no library
changes are needed.

## Why AIFS Single, not the IFS ensemble

`dynamical-zarr-ecmwf` reads the IFS ensemble (ENS). Each of its inner
chunks holds 32x32 pixels for all 85 lead times and all 51 ensemble
members, and the example draws one member. On a globe, the first view is
558 such tiles: about 1.3 GB in 558 requests, of which 2% is drawn, and
it took 3.5 minutes to load.

The AIFS Single store, from the same dynamical.org bucket, has no
ensemble dimension, and each inner chunk holds 241x240 pixels (60°x60°)
for all 61 lead times. The whole globe is 18 chunks, of 24-39 MB in
total depending on the run. In Chrome, with the browser cache off, the
example's first view loaded in about 7 seconds, from 22 requests and 24
MB.

## Changes

- New `examples/zarr-globe` (package `deck.gl-zarr-globe-example`), with
the data pipeline and controls of `dynamical-zarr-ecmwf`: it opens the
store with `ZarrSource.open(store, { path })`, checks the data type with
`is`, and passes the source to `ZarrLayer`. For the globe it follows
`cog-globe`: `projection="globe"`, `parameters: { depthCompare: "always"
}` on the layer so the raster does not z-fight the basemap sphere, and a
black background around the globe.
- Differences from `dynamical-zarr-ecmwf`, for AIFS: no ensemble member
in the selection; 61 lead times at a fixed 6-hour step, so each frame
shows for the same time (200 ms by default); a forecast run every 6
hours, with the run's hour next to the date picker; no `maxCacheSize`,
so tiles stay cached as the globe turns; and a default colour range of
-20 to 40 °C, which fits the temperatures in the default view better
than -40 to 50 °C, while the filter keeps -40 to 50 °C.
- Declares the grid `"spatial:registration": "node"`: the store's
coordinates put each value on its grid point, from 90° to -90° and -180°
to 179.75°. #862 makes the same change in `dynamical-zarr-ecmwf`. The
edge cells reach 0.125° past the poles, which #858 clamps on the globe.
- Uses the hosted Dark Matter style with `beforeId:
"boundary_country_outline"`, as `cog-globe` does, instead of copying the
flat example's custom water-less style.
- Docs examples page: a "Globe View" card in the Zarr section, with a
card image. The card shows +6 h of the 06 UTC run, midday over Africa.
It was taken after #858, which fixed dots that showed where the far-side
South Pole lands.
- `pnpm-lock.yaml`: adds the new importer only. The docs workflow and
the pnpm workspace already pick up `examples/*`.

## Tests

- Example-only change, no new tests. The workspace typecheck and the
example build pass, and Biome is clean.
- Checked in Chrome: the forecast drapes on the globe with country
borders and labels on top, with no z-fighting. Zooming in fetches
nothing new, the animation advances one 6 h step every 200 ms, and the
console shows no errors.

## Notes

- Near the globe's limb the raster can stop short, leaving slivers of
basemap. The cause isn't known yet. It would be in the shared globe
path, so it is not addressed here.

Closes #568

🤖 Written by [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant