async function loadData() {
const data = await FileAttachment("S_seaice_extent_daily_v3@3.0.csv").csv({
typed: true
});
const daysPerYear = 365.256363;
const oneDayInMillis = 1000 * 60 * 60 * 24;
const start = new Date(1978, 0, 0);
const twoPi = 2 * Math.PI;
const extentAverage = data.map((row) => row.Extent).reduce((x, y) => x + y, 0) / data.length;
return data.map((row) => {
const now = new Date(`${row.Year}-${row.Month}-${row.Day}`);
const day = (now - start) / oneDayInMillis;
// https://physics.stackexchange.com/questions/177949
const angle = twoPi * (day - 4) / daysPerYear % twoPi;
const distance = 1 - 0.01672 * Math.cos(angle);
const year = row.Year;
const extent = row.Extent - (extentAverage - 8 * Math.cos(angle - 0.8));
return { now, year, day, extent, angle, distance };
});
}