Repository navigation
feat(examples): add a zarr-globe example - #794
Conversation
The globe-view prototype added a COG globe example, but nothing showed the Zarr path on a globe. Add `examples/zarr-globe`: a copy of `dynamical-zarr-ecmwf` that renders the global ECMWF 2 m temperature forecast on MapLibre's globe projection with deck.gl interleaved. It follows `cog-globe`: `projection="globe"`, `depthCompare: "always"` on the layer so the raster does not z-fight the basemap sphere, a black background around the globe, and the hosted Dark Matter style with `beforeId: "boundary_country_outline"`. That style replaces the flat example's custom water-less style, which the globe does not need. Also list the example on the docs examples page with a card image. The docs workflow and the pnpm workspace already pick up `examples/*`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port zarr-globe to the ZarrLayer API from #812, as dynamical-zarr-ecmwf was ported there: open the array with `ZarrSource.open` and the GeoZarr attrs, pass the source as `source`, and use the `ZarrLayer<DataT, Dtype>` type parameter order. Drop `initTimeIdx` from the layer id, since changing `selection` now fetches tiles again (#818). Match dynamical-zarr-ecmwf's dependency versions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Note This comment was written by Claude (Claude Code), not by @kylebarron. I ported the example to the current API on main, so it typechecks again before 0.10.0. First I merged
I also corrected the description's Notes. The tiles aren't 320x320 (15 tiles of 80°). The store is sharded, and Verified:
🤖 Written by Claude Code |
|
we should also probably merge in latest main |
The IFS ensemble store packs all 51 members into each 32x32 chunk, so the globe's first view read about 1.3 GB in 558 requests to draw one member. AIFS Single has no ensemble dimension, and each chunk holds 61 lead times for 60 by 60 degrees: the whole globe is 18 chunks, about 24 MB. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Note This comment was written by Claude (Claude Code), not by @kylebarron.
Merged main in Since then, 🤖 Written by Claude Code |
… path #838 renamed `source.arrays` to `source.levels`, and opens a store with a path. This follows dynamical-zarr-ecmwf. Co-Authored-By: Claude Opus 5.5 <[email protected]>
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. On the globe, a raster whose grid runs past a pole drew a spray of dark dots over the near side of the globe. It showed up in the zarr-globe example (#794): its 0.25° ECMWF grid has rows centred on the poles, so the raster's last row ends at -90.25°. ## Cause - The globe path builds its mesh with `buildUniformGridMesh`, out to the tile's edge, with no latitude limit. Web Mercator limits its mesh to ±85.05° through `initialTriangulation`. - Past -90°, deck.gl's globe projection folds the mesh's last band over the pole, onto the far side of the globe. The folded triangles' winding flips, so back-face culling keeps them, and the layer's `depthCompare: "always"` doesn't hide them. - The folded triangles are much thinner than a pixel, so they render as scattered dots around the point where the far-side pole lands on screen. ## Fix `buildUniformGridMesh` clamps output latitudes to [-90, 90]. The mesh's last band then holds the part of its texture that lies past the pole, which isn't visible: in the example, about 1.87° of texture in a 1.62° band. ## Screenshots At the docs card's view of #794's example: centred on (0°, 20°) at zoom 2.6, at lead time 0. | Before | After | |---|---| |<img width="1800" height="1013" alt="before-card-view" src="https://github.com/user-attachments/assets/c040aded-8f58-4604-9592-2dde61272f87" /> | <img width="1800" height="1013" alt="after-card-view" src="https://github.com/user-attachments/assets/74b4e3d9-bed2-478d-8463-2e1748c67d94" /> | A 6x crop around where the far-side South Pole lands, before on the left and after on the right: <img width="960" height="320" alt="crop-before-after" src="https://github.com/user-attachments/assets/272c62c0-ffb0-4dc7-b174-d476b28d7a09" /> ## Tests - A new test checks that a grid with rows at 100°, 0° and -100° gets vertices at 90°, 0° and -90°. It fails without the clamp. - "places texCoords on the unit grid and positions via the reprojection chain" used a 257x257 identity grid, whose last vertex sat at y = 256, past the pole. It now uses 81x81. - The deck.gl-raster tests, the workspace typecheck and Biome pass. - Checked in Chrome with #794's example, at the docs card's view: the dots are there before and gone after. In three views, and at all 61 lead times in one of them, a count of the dark pixels around the far-side pole went from up to 176 to 0. 🤖 Written by [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
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]>
#858 fixed the dots, which the previous card showed in the South Atlantic. Co-Authored-By: Claude Opus 5.5 <[email protected]>
> [!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](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
this image should show better contrast; it's too washed out. I don't think the colormap is centered on warm-temperatures over africa
There was a problem hiding this comment.
Note
This comment was written by Claude (Claude Code), not by @kylebarron.
Two things washed it out, and both are fixed:
- The colour range. The default rescale of -40 to 50 °C put half of the visible area, 11 to 26 °C, into 17% of the colormap.
1325956anarrows the example's default to -20 to 40 °C. The filter keeps its own -40 to 50 °C default, so nothing new is hidden. - The time of day. The card showed lead time 0 of the 06 UTC run, which is early morning over Africa, when the Sahara is cooler than the ocean around it. The new card,
4c5c8a89, is at +6 h, 12 UTC.
🤖 Written by Claude Code
The -40 to 50 °C range put half of the default view (11 to 26 °C) into 17% of the colormap, so the globe looked washed out. The filter keeps its -40 to 50 °C default, so nothing new is hidden. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…trast Co-Authored-By: Claude Opus 5.5 <[email protected]>

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 thedynamical-zarr-ecmwfexample 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 handlesZarrLayer, so no library changes are needed.Why AIFS Single, not the IFS ensemble
dynamical-zarr-ecmwfreads 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
examples/zarr-globe(packagedeck.gl-zarr-globe-example), with the data pipeline and controls ofdynamical-zarr-ecmwf: it opens the store withZarrSource.open(store, { path }), checks the data type withis, and passes the source toZarrLayer. For the globe it followscog-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.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; nomaxCacheSize, 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."spatial:registration": "node": the store's coordinates put each value on its grid point, from 90° to -90° and -180° to 179.75°. fix(examples): declare the ECMWF grid node-registered #862 makes the same change indynamical-zarr-ecmwf. The edge cells reach 0.125° past the poles, which fix(deck.gl-raster): clamp globe mesh latitudes to the poles #858 clamps on the globe.beforeId: "boundary_country_outline", ascog-globedoes, instead of copying the flat example's custom water-less style.pnpm-lock.yaml: adds the new importer only. The docs workflow and the pnpm workspace already pick upexamples/*.Tests
Notes
Closes #568
🤖 Written by Claude Code