Repository navigation
fix(deck.gl-raster): clamp globe mesh latitudes to the poles - #858
Merged
Merged
Conversation
A raster whose grid runs past a pole, such as a 0.25° global grid with rows centred on the poles, put the globe mesh's last row of vertices past -90°. The globe projection folds that band over the pole, the folded triangles face the camera from the far side of the globe, and with `depthCompare: "always"` they drew over the near side as a spray of dark dots. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
added a commit
that referenced
this pull request
Nov 6, 2026
#858 fixed the dots, which the previous card showed in the South Atlantic. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 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]>
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
buildUniformGridMesh, out to the tile's edge, with no latitude limit. Web Mercator limits its mesh to ±85.05° throughinitialTriangulation.depthCompare: "always"doesn't hide them.Fix
buildUniformGridMeshclamps 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.
A 6x crop around where the far-side South Pole lands, before on the left and after on the right:
Tests
🤖 Written by Claude Code