Repository navigation
feat: Zarr AEF example - #467
Merged
Merged
Conversation
AlphaEarth Foundations GeoZarr Mosaic example. Uploads 64 bands per tile as an r8sint Texture2DArray; users pick three bands for an RGB composite and dequantization happens in-shader. One upstream ZarrLayer change: derive tile size from the inner sharding codec chunk, not the outer shard. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Verified that [email protected]'s Array.chunks already returns the inner sharding chunk shape for sharded arrays (hierarchy.js createContext sets chunkShape from the sharding codec configuration). So the existing arr.chunks[arr.chunks.length - 1] tile-size derivation is correct for the AEF store, and the planned upstream change is a no-op. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Vite + React + MapLibre scaffolding for the AlphaEarth Foundations GeoZarr Mosaic example. No data layer yet — just a dark basemap centered on San Francisco Bay to confirm the dev server boots. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Static data modules for the example: zarr URL + dequantization constants, buildSelection() for pinning the year, and a list of preset regions for the location dropdown. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Combined sample + dequantize + rescale module. Samples three layers of an r8sint Texture2DArray at user-selected band indices, dequantizes via (v/127.5)^2 * sign(v) in-shader, linearly rescales each channel to [0, 1], and discards pixels where any sampled channel is the int8 nodata sentinel -128. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Slices one year × all 64 bands × tile bounds via zarrita, uploads the raw int8 data to an r8sint Texture2DArray. Checks chunk shape defensively to catch selection/metadata misalignments early. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Opens the embeddings array, passes the root group attrs to ZarrLayer as a metadata override (the store's top-level spatial:* attrs are already GeoZarr compliant), and renders bands 0/16/32 as R/G/B for 2025 with a [-0.3, 0.3] rescale. No UI controls yet — state is hardcoded to establish the rendering path end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Location dropdown (flyTo), year slider (re-keys layer → refetch), three band dropdowns (uniform-only change), and a shared rescale range slider. Band labels fetched asynchronously from the `band` zarr coord at mount. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The AEF mosaic example relies on zarrita returning the inner sharding chunk shape via arr.chunks (not the outer 4096x4096 shard). This test synthesizes a sharded Zarr v3 array and asserts arr.chunks equals the inner chunk shape, so a future zarrita version that changes this behavior fails loudly. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The traversal's z=0 loop instantiated every tile in the coarsest level's matrix upfront, relying on frustum culling downstream to discard the ones outside the viewport. For traditional OGC pyramids that's fine (z=0 is ~1 tile), but single-level Zarr descriptors can be thousands × thousands of tiles at their native resolution — the AEF mosaic (4009984 × 1859584 px at 256² tiles) instantiates ~114M RasterTileNodes at startup, effectively hanging the page. Cull to the intersection of the dataset extent and the viewport's WGS84 bounds: project the four corners into the source CRS via `descriptor.projectFrom4326` and consult the root level's existing crsBoundsToTileRange. Typical viewport → tens of root tiles. If the viewport and dataset don't overlap, traversal is skipped entirely. Prototype commit — to be extracted onto its own branch for a standalone perf: PR once verified end-to-end via the AEF example. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
# Conflicts: # packages/deck.gl-raster/src/raster-tileset/raster-tile-traversal.ts
Replace the app-level viewport-zoom gate with the layer's built-in minZoom / visibleMinZoom pair (new in deck.gl 9.3). Tiles fetched at zoom ≥ 12 remain visible down to zoom 11, so zooming out by one level stays smooth instead of snapping to blank. Adds `visibleMinZoom` / `visibleMaxZoom` to the RasterTileLayerProps pass-through so any RasterTileLayer subclass (ZarrLayer, COGLayer) can expose them. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Matches PR #466 (refactor: Don't honor visibleMinZoom / visibleMaxZoom). Consolidates FETCH_MIN_ZOOM / VISIBLE_MIN_ZOOM into a single MIN_ZOOM constant and removes the visibleMin/MaxZoom pass-through from RasterTileLayerProps (the passthrough never landed on main; it was only ever in the earlier commit on this branch). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Better UX mapping between control type and cost:
- Year → dropdown. Changing the year refetches every visible tile
(new zarr chunks), so discrete commits are right.
- R / G / B band → sliders. Changing bands is a shader uniform change
with no network — scrubbing should feel instant, and the wider label
("Red band: A17") updates live as you drag.
Rescale range was already a slider; location stays a dropdown.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
marked this pull request as ready for review
April 24, 2026 16:23
kylebarron
enabled auto-merge (squash)
April 24, 2026 16:25
Closed
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.
Change list
isas a type guard to reduce casts (https://zarrita.dev/packages/zarrita.html#data-typing-in-typescript)The creation of this example also discovered improvements merged separately in #464, #465, #466
Future todo