Public
Edited
Nov 24, 2022
1 fork
60 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
latitude = location[1]
Insert cell
center = latitude < 0 ? 0 : 180
Insert cell
periods = new Map([
["day", 1],
["week", 7],
["month", 30]
])
Insert cell
days = d3
.utcDays(Date.UTC(2000, 0, 1), Date.UTC(2001, 0, 1), periods.get(period))
.slice(0, -1)
Insert cell
hours = days.flatMap((day) => d3.utcHours(day, +day + 24 * 3600 * 1000, 1))
Insert cell
data = hours
.map((date) => ({
date,
hour: date.getUTCHours(),
...getSunPosition(date, ...location)
}))
.filter((d) => d.altitude > 0)
Insert cell
import { getSunPosition } from "@mourner/sun-position-in-900-bytes"
Insert cell
import { worldMapCoordinates } from "@enjalot/draggable-world-map-coordinates-input"
Insert cell
import { degrees } from "@fil/math"
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