Skip to content

feat: NLDAS-3 icechunk example#577

Merged
kylebarron merged 24 commits into
mainfrom
kyle/icechunk-example
May 27, 2026
Merged

feat: NLDAS-3 icechunk example#577
kylebarron merged 24 commits into
mainfrom
kyle/icechunk-example

Conversation

@kylebarron
Copy link
Copy Markdown
Member

@kylebarron kylebarron commented May 27, 2026

image

Cool to see fetches going into NetCDF files:
image


Summary

Adds examples/nldas-icechunk — a minimal example proving the
icechunk-js → zarrita → ZarrLayer path works in the browser (closes #569).

  • Opens the public NLDAS-3 icechunk repo with icechunk-js@0.4, authorizing the
    one virtual chunk container (s3://nasa-waterinsight/NLDAS3/forcing/daily/)
    via ReadSession.open(…, { virtualChunkContainers }) so virtual chunks resolve
    to public HTTPS objects.
  • Renders a single static Tair (air temperature) timestep with the GPU colormap
    pipeline (CreateTexture → FilterNoDataVal → LinearRescale → Colormap). The
    store isn't GeoZarr-compliant, so synthetic spatial attrs are hard-coded (same
    approach as the ECMWF example).
  • scripts/smoke.ts is the spike used to prove virtual-chunk reads and derive the
    grid (origin/pixel-size/shape, units, fill); kept for reproducibility.

Notable: NLDAS-3 latitude is ascending (row 0 = south), so the affine has a
positive row-step e. Verified that deck.gl-raster's affine tiling renders this
correctly (not flipped).

Test Plan

  • pnpm typecheck — clean
  • pnpm build — clean
  • Manual render: Tair displays correctly placed/oriented over North America
    with the thermal colormap; ocean fill (-9999) discarded to the basemap.
  • Reviewer sanity-check in a real browser (cd examples/nldas-icechunk && pnpm dev)

Written by Claude on behalf of @kylebarron

🤖 Generated with Claude Code

kylebarron and others added 10 commits May 27, 2026 14:58
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the feat label May 27, 2026
kylebarron and others added 3 commits May 27, 2026 15:47
Adds a ControlPanel (intro-only, no controls) describing the example,
matching the other examples' info box. Re-adds Chakra deps for Text.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Set maxBounds to lon [-169, -52], lat [7, 72] so the map can't pan or
zoom out beyond where data exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread examples/nldas-icechunk/src/nldas/get-tile-data.ts Outdated
The grid constants are baked into metadata.ts; the spike was scaffolding.
Removes scripts/smoke.ts, its README section, the tsx devDep, and the
scripts tsconfig include.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread examples/nldas-icechunk/src/nldas/get-tile-data.ts Outdated
Comment thread examples/nldas-icechunk/src/nldas/metadata.ts Outdated
Comment thread examples/nldas-icechunk/src/nldas/metadata.ts Outdated
Comment thread examples/nldas-icechunk/src/nldas/metadata.ts Outdated
Comment on lines +59 to +61
* NLDAS-3 latitude is ASCENDING (row 0 = south, lat 7.005°), so the row step
* `e` is positive and the origin is the bottom-left cell corner = first cell
* center − half a pixel. Grid: 0.01° over lon [-169, -52], lat [7, 72].
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.

Interesting... Does this imply that #321 is now fixed? Or is this separate?

kylebarron and others added 6 commits May 27, 2026 16:07
- Drop the CPU nodata-replacement loop: the source uses a finite -9999
  sentinel (no NaN), already discarded on the GPU by FilterNoDataVal.
- Remove redundant mipLevels: 1 (luma's default is already 1).
- Rename Tair -> descriptive surface-temperature naming in identifiers and
  docstrings; keep the literal "/Tair" store path (the array's real name).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds runtime controls to the intro panel (reusing the shared Field,
NativeSelect, ColormapPreview, and RangeSlider), matching the other
examples. A new colormap-choices list drives the picker; rescale min/max
become state with updateTriggers so cached tiles re-render on change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Slider still operates in Kelvin (the shader's unit); only the label
converts, e.g. "10°C (283 K) – 40°C (313 K)".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The store's lat/lon coords are float32; deriving the affine by subtracting
them injected precision noise (dLon ~0.00999451), drifting the east edge to
-52.064 (~7 km). Use the exact intended grid: origin (-169, 7), step 0.01°.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NLDAS-3 is a v1 icechunk repo. Without an explicit formatVersion,
Repository.open auto-detects by fetching the v2 "/repo" marker, which
404s (then falls back to v1). Passing formatVersion: "v1" skips that
probe. Verified: /repo requests drop 1 -> 0 per open (2 -> 0 with
StrictMode's dev double-mount) while the array still opens.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread examples/nldas-icechunk/src/nldas/metadata.ts Outdated
kylebarron and others added 2 commits May 27, 2026 16:38
…lue attr

Instead of hard-coding NODATA_VALUE = -9999, openSurfaceTemp now reads
(and validates) the array's `missing_value` attribute and returns it
alongside the array. The render pipeline gets the fill sentinel from the
store rather than a constant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kylebarron kylebarron merged commit 2cf36ad into main May 27, 2026
5 checks passed
@kylebarron kylebarron deleted the kyle/icechunk-example branch May 27, 2026 21:01
@kylebarron kylebarron self-assigned this Jun 1, 2026
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.

Add icechunk-based Zarr example

1 participant