Public
Edited
Jul 4, 2023
Insert cell
Insert cell
zoom = 11
Insert cell
Insert cell
Insert cell
locations = [
['Zurich', 47, 8],
['Melbourne', -37.8, 145.08],
['San Francisco', 37.76, -122.44 ],
['Santiago', -33.44, -70.66],
['Sapporo', 43.079, 141.358]
]
Insert cell
SunCalc = require("suncalc@1.9.0")

Insert cell
isDaytime = (lat, lon, zoom, timestamp) => {
const {sunrise, sunset} = SunCalc.getTimes(timestamp, lat, lon);
return timestamp >= sunrise && timestamp <= sunset;
}
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