developmentseed / developmentseed/cng-sandbox
feat: add point-click time series extraction for Zarr
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 0
- Avg merge
- 2h 21m
- Merged PRs (30d)
- 3
Description
## Summary
Click a point on a Zarr map to extract and chart the full time series at that location. This requires a custom backend endpoint since browser-side extraction is impractical (one HTTP request per time step).
## Background
Extracting a time series from a Zarr store at a specific lat/lon requires reading one value per time step. For climate data with hundreds of time steps, this means hundreds of chunk fetches — practical on the server with xarray but not in the browser. A custom FastAPI endpoint using xarray's `.sel(method='nearest')` can extract this efficiently.
## Acceptance Criteria
- [ ] New FastAPI endpoint: `GET /api/zarr/timeseries?url=&variable=&lat=&lon=`
- [ ] Endpoint uses xarray to extract values across all time steps at the nearest grid point
- [ ] Returns JSON with `times` and `values` arrays
- [ ] Frontend chart component in the sidebar renders the time series (line chart)
- [ ] Map click handler on Zarr layers sends coordinates to the endpoint
- [ ] Loading state shown while extraction is in progress
- [ ] Handles errors gracefully (non-temporal data, invalid coordinates, unreachable stores)
## Files to Modify
- New endpoint in `ingestion/src/routes/`
- New chart component in `frontend/src/components/`
- `frontend/src/pages/MapPage.tsx` — click handler
- `frontend/src/components/MapSidePanel.tsx` — chart slot
## Dependencies
- Depends on: `feat: add Zarr URL connection type with variable selection`
- Independent of dimension selection and time animation issues
Contributor guide
Assessment
This issue has not been assessed yet.