Skip to content

Charts: density map of adult blacktip capture locations (#174) - #179

Merged
Luen merged 7 commits into
feat/173-shark-moves-mapfrom
feat/174-adult-density
Nov 12, 2026
Merged

Luen merged 7 commits into
feat/173-shark-moves-mapfrom
feat/174-adult-density

Conversation

@Luen

@Luen Luen commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Closes #174. Stacked on #178 → #177; merge those first.

What

  • /adults → "Where adults are caught": a kernel density of adult capture GPS points on the sequential --seq scale (5 classes, cells under 5% of the peak dropped), with the single capture spots on top. Each layer has its own toggle.
  • analytics/density.ts: Gaussian KDE on a local km projection, Silverman bandwidth with a 0.3 km floor, 60-cell grid, and ≥ 20 points before a surface is drawn (otherwise dots only). Also has onLand / kmFromCoast checks against the Moorea outline. Unit tests use simulated clusters.
  • Points that are on land, more than 5 km offshore or with a positive longitude are left out, and the note counts them; captures without GPS are counted too. Nothing is dropped silently, but these go in the chart note, not the Data quality page (they're found at load time, not import time).
  • The note says density shows where the team fished and caught sharks, not where adults live.
  • InteractiveMap: new density prop (grid cells → rectangles, CSS-coloured, non-interactive).

Real data

39 usable points → bandwidth hits the 0.3 km floor; the surface shows three capture areas. 20 captures have no GPS point.

Open

Whether showing this publicly is fine is question 2 in #176 (the same points are already public as dots on /nurseries).

Checks

pnpm lint, pnpm check, pnpm test (122 passed), pnpm build, pnpm test:e2e (38 passed).

🤖 Generated with Claude Code

/adults gets a map of where adults are caught: a Gaussian kernel
density of the GPS points (Silverman bandwidth with a 0.3 km floor) on
the sequential scale, under the single capture spots. Points on land,
more than 5 km offshore or with a positive longitude are left out and
counted in the note; the note also says density follows fishing
effort. Below 20 points only the dots are drawn.

InteractiveMap gains a toggleable density layer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Luen
Luen added this pull request to stack #181 November 10, 2026 23:27
# Conflicts:
#	src/lib/components/InteractiveMap.svelte
@Luen

Luen commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed all five changed files and pushed a fix.

[P2] Keep GPS exclusions visible when no usable points remain. The whole location section was guarded by data.where.points.length. If every adult record had missing or rejected coordinates, this hid the missing count and rejection reasons, silently dropping the location information. The section now retains those notices and explicitly says that no usable GPS points are available; it only mounts the map when there are points.

Fixed in 4c7bd34, with two browser regressions in a4c526b. These inject synthetic response data for all-missing GPS and mixed missing/rejected GPS, and verify the empty state and counts. No source workbooks were altered.

Reviewed KDE bandwidth/grid/binning, coastline checks and density layers. The tooltip and playback fixes from #177/#178 are merged into this branch and propagated to #184. Final combined-stack validation: lint, type checks, production build, 126 unit tests and all 41 browser tests passed. Two opt-in real-data tests were skipped because private data is unavailable. The existing lab question about publishing capture locations remains open; no PR was merged or deployed.

@Luen

Luen commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Re-reviewed #179 against its parent, including KDE bandwidth/grid/binning, coordinate rejection rules, counts for missing/rejected GPS, density overlay ordering/toggles, and the existing all-unusable-GPS regressions. No additional defect found in this PR's own changes.

Merged the reviewed parent fix from #178 (bbb7442) without conflicts, so this branch retains keyboard access to move maps and the SVG fallback. The map still describes capture density and uneven fishing effort; it does not claim adult habitat use.

Validated final head 7c3cc05: pnpm lint; pnpm check (0 errors/warnings); pnpm test (122 passed, 2 opt-in tests skipped); opt-in real-data import test (1 passed); pnpm build; pnpm test:e2e (43 passed, including both GPS empty states and the inherited keyboard regressions). Parent-fix merge pushed. Review complete; no spreadsheets changed.

@Luen
Luen merged commit f102980 into main Nov 12, 2026
6 checks passed
@Luen
Luen deleted the feat/174-adult-density branch November 12, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charts: density map of adult blacktip capture locations

1 participant