Public
Edited
Aug 1, 2023
1 fork
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// https://observablehq.com/@tophtucker/parse-sequential-dates
data = {
let year, arr = [];
const parse = d3.timeParse("%d %b, %Y %H:%M");
for (const { Date, Flyby } of raw) {
const d = parse(`${Date} ${Flyby}`);
if (d) {
year = d.getFullYear();
arr.push(d);
} else {
const d = parse(`${Date}, ${year} ${Flyby}`);
if (d > arr[arr.length - 1]) {
arr.push(d);
} else {
year++;
arr.push(parse(`${Date}, ${year} ${Flyby}`));
}
}
}
return arr;
}
Insert cell
SunCalc = require("suncalc")
Insert cell
sun = d3.timeDay.range(...d3.extent(data)).map(day => SunCalc.getTimes(day, 37.79, -122.41))
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more