From e62264266cf07551463dc2fb0ec1b950214cc9c6 Mon Sep 17 00:00:00 2001 From: luen Date: Wed, 11 Nov 2026 09:23:36 +1000 Subject: [PATCH 1/2] Pressure: compare the low-tourism 2020-21 season with the others (#175) Tourism on Moorea fell by more than half in 2020 (ISPF). Fieldwork runs October to February, so the border closure missed it, but 2020-21 was sampled while visitors were scarce. /pressure now compares that season's catch rate with the rest (negative-binomial LRT, adjusted for nursery and day of the season), with copy that says one season is confounded with everything else about that year. ISPF's island series are PDF-only and PGEM zones need a data source (#176), so neither is charted yet. Co-Authored-By: Claude Opus 5.5 --- src/routes/pressure/+page.server.ts | 33 ++++++++++++++++++- src/routes/pressure/+page.svelte | 50 ++++++++++++++++++++++++++++- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/routes/pressure/+page.server.ts b/src/routes/pressure/+page.server.ts index 44939ed..51f849a 100644 --- a/src/routes/pressure/+page.server.ts +++ b/src/routes/pressure/+page.server.ts @@ -14,6 +14,9 @@ import { mean, median, pairs, se, spearman, welch } from '#lib/stats'; import { rankText, rateTest, rateText } from '#lib/server/analytics/tests'; import type { PageServerLoad } from './$types'; +/** Sampled October 2020 – February 2021, when tourism on Moorea was far below normal (ISPF). */ +const LOW_TOURISM_SEASON = '2020-2021'; + export const load: PageServerLoad = () => memo('pressure', (d) => { const eff = effortSets(d); @@ -133,6 +136,23 @@ export const load: PageServerLoad = () => breakDays.map((s) => s.cpue), quiet.map((s) => s.cpue) ); + // The first COVID-19 season (#175): fieldwork runs October to February, so the 2020 border + // closure (March to July) missed it, but 2020-21 was sampled while tourism was far below + // normal. One season, so it is confounded with everything else about that year. + const lowTourism = dated.filter((s) => s.season === LOW_TOURISM_SEASON); + const otherSeasons = dated.filter((s) => s.season !== LOW_TOURISM_SEASON); + const covid = lowTourism.length + ? { + season: LOW_TOURISM_SEASON, + groups: [group(lowTourism, 'low'), group(otherSeasons, 'other')], + test: rateTest( + dated, + { groupOf: (s) => (s.season === LOW_TOURISM_SEASON ? 'low' : 'other') }, + 'cpue', + ['season'] + ) + } + : null; const holidaySets = new Map(); const breakSets = new Map(); for (const s of dated) { @@ -153,7 +173,8 @@ export const load: PageServerLoad = () => human: scatter('human', 'growth'), composite: scatter('composite', 'cpueCm'), dayType: rateText(rateTest(dated, { groupOf: (s) => type(s) }), 'types of day'), - weekday: rateText(rateTest(dated, { groupOf: (s) => s.weekday }), 'days of the week') + weekday: rateText(rateTest(dated, { groupOf: (s) => s.weekday }), 'days of the week'), + covid: covid ? rateText(covid.test, 'the 2020–21 season and the others') : null }; return { stats, @@ -161,6 +182,16 @@ export const load: PageServerLoad = () => metrics, outcomes: outcomes.map((o) => o[1]), corr, + covid: covid + ? { + season: covid.season, + groups: covid.groups, + ratio: + covid.groups[0].mean != null && covid.groups[1].mean + ? round(covid.groups[0].mean / covid.groups[1].mean, 2) + : null + } + : null, busyDays: { byType, byWeekday, diff --git a/src/routes/pressure/+page.svelte b/src/routes/pressure/+page.svelte index c12c782..40ef4b8 100644 --- a/src/routes/pressure/+page.svelte +++ b/src/routes/pressure/+page.svelte @@ -4,7 +4,7 @@ import BarChart from '#lib/components/charts/BarChart.svelte'; import Heatmap from '#lib/components/charts/Heatmap.svelte'; import Scatter from '#lib/components/charts/Scatter.svelte'; - import { num } from '#lib/format'; + import { num, season } from '#lib/format'; import { SPECIES } from '#lib/species'; import type { PageProps } from './$types'; @@ -170,6 +170,54 @@ + {#if data.covid} + {@const c = data.covid} +
+

A season with few visitors

+

+ Tourism on Moorea fell by more than half in 2020 (ISPF), the closest thing this record has + to a season with fewer people on the water. Fieldwork runs from October to February, so the + border closure itself (March to July 2020) fell outside it, but the {season(c.season)} season + was sampled while visitor numbers were still far below normal. Its catch rate was {num( + c.groups[0].mean, + 2 + )} sharks per net-hour against {num(c.groups[1].mean, 2)} in the other seasons{c.ratio != + null + ? ` (${num(c.ratio, 2)} times)` + : ''}. +

+ + `${g.label === 'low' ? season(c.season) : 'Other seasons'} (${g.n})` + )} + series={[ + { + name: 'Sharks / net-hour', + color: 'var(--series-1)', + values: c.groups.map((g) => g.mean) + } + ]} + errors={c.groups.map((g) => (g.lo != null && g.hi != null ? [g.lo, g.hi] : null))} + valueFormat={(v) => num(v, 2)} + /> + +

+ Tourism figure: Institut de la statistique de la Polynésie française, + Bilan du tourisme 2020. ISPF's island-level series are published as PDF dashboards, not open tables, so the site + doesn't chart tourism over time yet. +

+
+ {/if} +

Busy days

From c3e341c0879796d804d10e58b5875f6cff98b75b Mon Sep 17 00:00:00 2001 From: luen Date: Thu, 12 Nov 2026 10:16:22 +1000 Subject: [PATCH 2/2] fix: describe the actual low-tourism sample and source metric --- AGENTS.md | 1 + src/routes/pressure/+page.server.ts | 12 ++++++++---- src/routes/pressure/+page.svelte | 21 ++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index da2a181..bf07128 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -235,3 +235,4 @@ Questions for the lab go to Dr Jodie Rummer (`@JodieRummer`) on GitHub: label th | 2026-11 | v0.2.10: pressure scores from the Bouyoucos et al. (2024) dataset (#131); year-off recaptures take their set's date (#133); lab statistics conventions (#132) and sex-ratio wording (#130); capture numbers that disagree with the tags go on the Data quality page (#168). | - Security scans (#144): use Snyk CLI >=1.1308.3 with `test --all-projects --dev` for the pnpm 12 multi-document lockfile. Remaining upstream advisories and mitigations are tracked in docs/dev/SNYK-144.md. +- Seasonal comparisons must report dates from their eligible sets, not an assumed October–February window (2020–21 starts in September). ISPF's Moorea hotel-room sales are a visitor proxy, not a count of people on the water. diff --git a/src/routes/pressure/+page.server.ts b/src/routes/pressure/+page.server.ts index 51f849a..cf32819 100644 --- a/src/routes/pressure/+page.server.ts +++ b/src/routes/pressure/+page.server.ts @@ -14,7 +14,7 @@ import { mean, median, pairs, se, spearman, welch } from '#lib/stats'; import { rankText, rateTest, rateText } from '#lib/server/analytics/tests'; import type { PageServerLoad } from './$types'; -/** Sampled October 2020 – February 2021, when tourism on Moorea was far below normal (ISPF). */ +/** Season sampled while tourism on Moorea was far below normal (ISPF). */ const LOW_TOURISM_SEASON = '2020-2021'; export const load: PageServerLoad = () => @@ -136,14 +136,16 @@ export const load: PageServerLoad = () => breakDays.map((s) => s.cpue), quiet.map((s) => s.cpue) ); - // The first COVID-19 season (#175): fieldwork runs October to February, so the 2020 border - // closure (March to July) missed it, but 2020-21 was sampled while tourism was far below - // normal. One season, so it is confounded with everything else about that year. + // The first COVID-19 season (#175). Report its actual eligible dates: sampling does not + // always start in October. One season is confounded with everything else about that year. const lowTourism = dated.filter((s) => s.season === LOW_TOURISM_SEASON); const otherSeasons = dated.filter((s) => s.season !== LOW_TOURISM_SEASON); + const lowDates = lowTourism.map((s) => s.date!).sort(); const covid = lowTourism.length ? { season: LOW_TOURISM_SEASON, + first: lowDates[0], + last: lowDates.at(-1)!, groups: [group(lowTourism, 'low'), group(otherSeasons, 'other')], test: rateTest( dated, @@ -185,6 +187,8 @@ export const load: PageServerLoad = () => covid: covid ? { season: covid.season, + first: covid.first, + last: covid.last, groups: covid.groups, ratio: covid.groups[0].mean != null && covid.groups[1].mean diff --git a/src/routes/pressure/+page.svelte b/src/routes/pressure/+page.svelte index 40ef4b8..e8a1845 100644 --- a/src/routes/pressure/+page.svelte +++ b/src/routes/pressure/+page.svelte @@ -4,7 +4,7 @@ import BarChart from '#lib/components/charts/BarChart.svelte'; import Heatmap from '#lib/components/charts/Heatmap.svelte'; import Scatter from '#lib/components/charts/Scatter.svelte'; - import { num, season } from '#lib/format'; + import { date, num, season } from '#lib/format'; import { SPECIES } from '#lib/species'; import type { PageProps } from './$types'; @@ -175,14 +175,11 @@

A season with few visitors

- Tourism on Moorea fell by more than half in 2020 (ISPF), the closest thing this record has - to a season with fewer people on the water. Fieldwork runs from October to February, so the - border closure itself (March to July 2020) fell outside it, but the {season(c.season)} season - was sampled while visitor numbers were still far below normal. Its catch rate was {num( - c.groups[0].mean, - 2 - )} sharks per net-hour against {num(c.groups[1].mean, 2)} in the other seasons{c.ratio != - null + Hotel room sales on Moorea fell by more than half in 2020 (ISPF), a proxy for fewer visitors + rather than a count of people on the water. The {season(c.season)} comparison uses timed sets + from {date(c.first)} to {date(c.last)}, after borders first reopened in July 2020, while + visitor numbers were still far below normal. Its catch rate was {num(c.groups[0].mean, 2)} sharks + per net-hour against {num(c.groups[1].mean, 2)} in the other seasons{c.ratio != null ? ` (${num(c.ratio, 2)} times)` : ''}.

@@ -209,11 +206,9 @@

Tourism figure: Institut de la statistique de la Polynésie française, - Bilan du tourisme 2020. ISPF's island-level series are published as PDF dashboards, not open tables, so the site - doesn't chart tourism over time yet. + >. An island-level tourism time series is not yet included on this site.

{/if}