Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,6 @@ 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.
- Leaflet treats string tooltips as HTML. Pass a DOM element populated with `textContent` for workbook-derived point and move labels, including when rebuilding overlays.
- Leaflet polylines are pointer-only by default. Keep move paths keyboard-focusable, with focus tooltips and Enter/Space popup handlers; the SVG fallback uses the shared chart `markKeys` contract.
37 changes: 36 additions & 1 deletion src/routes/pressure/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/** Season sampled while 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);
Expand Down Expand Up @@ -133,6 +136,25 @@ export const load: PageServerLoad = () =>
breakDays.map((s) => s.cpue),
quiet.map((s) => s.cpue)
);
// 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,
{ groupOf: (s) => (s.season === LOW_TOURISM_SEASON ? 'low' : 'other') },
'cpue',
['season']
)
}
: null;
const holidaySets = new Map<string, number>();
const breakSets = new Map<string, number>();
for (const s of dated) {
Expand All @@ -153,14 +175,27 @@ 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,
rows,
metrics,
outcomes: outcomes.map((o) => o[1]),
corr,
covid: covid
? {
season: covid.season,
first: covid.first,
last: covid.last,
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,
Expand Down
45 changes: 44 additions & 1 deletion src/routes/pressure/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 { date, num, season } from '#lib/format';
import { SPECIES } from '#lib/species';
import type { PageProps } from './$types';

Expand Down Expand Up @@ -170,6 +170,49 @@
</ChartCard>
</section>

{#if data.covid}
{@const c = data.covid}
<section class="section">
<h2>A season with few visitors</h2>
<p>
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)`
: ''}.
</p>
<ChartCard
title={`Catch rate in ${season(c.season)} and the other seasons`}
subtitle="Mean sharks per net-hour per set, sets in brackets. Whiskers: 95% confidence intervals"
stats={data.stats.covid}
note="One season stands in for low tourism, so anything else that was different that year (weather, which nurseries were sampled, crew, the pups born) is mixed into the comparison. Read it as a description, not as the effect of tourism."
>
<BarChart
categories={c.groups.map(
(g) => `${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)}
/>
</ChartCard>
<p class="muted small">
Tourism figure: Institut de la statistique de la Polynésie française,
<a href="https://www.ispf.pf/publication/le-bilan-du-tourisme-de-l-annee-2020"
>Bilan du tourisme 2020</a
>. An island-level tourism time series is not yet included on this site.
</p>
</section>
{/if}

<section class="section">
<h2>Busy days</h2>
<p>
Expand Down
Loading