Published
Edited
Nov 8, 2020
Insert cell
Insert cell
astronomia = require('https://raphaelsaunier.com/observable/astronomia.js')
Insert cell
Insert cell
planetNames = ['mercury', 'venus', 'earth', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune'];
Insert cell
planets = Object.keys(celestialBodies)
.filter(body => body !== 'sun')
.reduce((planets, planet) => {
const data = astronomia.data['vsop87B' + planet];
planets[planet] = new astronomia.planetposition.Planet(data)
return planets;
}, {})
Insert cell
Insert cell
Insert cell
Insert cell
logBase
Insert cell
Insert cell
Insert cell
equinoxEarth = planets['earth'].position2000(astronomia.solstice.december(2019))
Insert cell
Insert cell
// Debug helper to ensure that the projections are correct
viewof scaleRange2 = html`<input type="range" value="0" min="0" max="1000"/>`
Insert cell
viewof canvasSize = html`<input type="range" value="400" step="10" min="200" max="940"/>`
Insert cell
md`Based on : https://observablehq.com/@raphaelsaunier/projecting-planetary-positions-on-a-ring`
Insert cell
viewof logBase2 = html`<input type="range" value="10" min="2" max="50"/>`
Insert cell
{
let adjRangeFn = (r, b) => { return Math.log10(r)/Math.log10(b) };
return Array(10).fill(0).map(
(_, i) => {
return Object.keys(planetPositionsOnDate).map((p) => {
return adjRangeFn(planetPositionsOnDate[p]['day'].range + 0.6, i + 2)
// return p
});
}
);
}

Insert cell
ld = luxon.DateTime.local()
Insert cell
end = ld.plus({days: orbitalPeriods['mars']});
Insert cell
resDate = orbitalPeriods['mars'] / 64
Insert cell
orbInterval = luxon.Interval.fromDateTimes(ld,end);
Insert cell
orbInterval.divideEqually(64);
Insert cell
dur = orbInterval.toDuration()
Insert cell
dur.as('days');
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