happy equinox
[1]To all those who celebrate.
A few days ago, in a moment of mild frustration, I listed my works in progress, or projects[2], and roughly organised them into four categories.
- not yet started / ideas
- started
- paused
- abandonned
This exercise did not provide the requisite motivation to resume any of the paused, but just enough to start a new one[3][4]: making an ✨interactive✨ version of my sun calendar[5] in d3.js
. Because on the off chance someone, anyone[6], feels like having their own custom version of my solar calendar, they would either have to (1) download the source code; work out what python environment I used; and hope that it works; or (2) ask me nicely. Wouldn't it be better if it could just happen in the browser? yes. yes it would.
d3 or not d3
This requires first getting my head around d3
, which has a very steep learning curve. I made a start. Upon realising that I couldn't easily add a colour gradient to a line based on a second dependent variable, I had a tantrum and pivoted to using plotly.js
[7].
plotly
also lakes this feature. But at least it's a touch more beginner friendly.
Making scatter plots with markers coloured by the second dependent variable is straightforward, and if you make the markers big enough, and plot enough of them, then you have the apperance of a line which changes colour.
I continue with plotly
suncalc or not suncalc
I've used the SunCalc
library before and I like it. It is lightweight, has only a handful of functions and works.
Reasonably quickly I had the bulk of the logic down, and it was working. But, in testing I came across something a bit curious. Something that my gut said was off. I went hunting for another library, and found astronomy
, which looks good. And gets bonus points for easily being able to swap the sun for a planet. A quick(ish) comparison later, and it turns out my gut was wrong and my intuition off. The path the sun takes at low latitudes near the solstices is curious. This excellent tool by Dr. Andrew Marsh helped clear up my confusion.[8].
In the process of trying to work out if I was doing something wrong, I compared the results of suncalc.js
with suncalc-py
and they weren't agreeing. This also took a while to unpick. To cut a frustrating hour or so short...user error: inadvertantly swapped latitude and longitude.
I continue with SunCalc
tz or utc
My lack of familiarity with js
is exposed when it comes to dealing with date
objects. Previously I've used the spacetime
library with the geo
extension. However, I suspect I was using it incorrectly then...after a bit of hunting and some quick experiments I settled on using Geoapify's geocode API for getting timezones rather than relying on a js
library. My API key is limited to 3000 requests per day. That's plenty.
nearly there
So far, I've got the bulk of the main figure done. I still need to add / tweak / modify:
- timezone support
- subplots
- analemma
- compoass rose
- daylight plot
- input / control box
- with a map instead of lat, lon
<inputs>
- light / dark / theme toggle
- custom title
- font options
- with a map instead of lat, lon
footnotes
yes i am a few days late ↩︎
not sure what else to call them, but projects doesn't feel quite right. but good enough ↩︎
the lure of a clean slate; a new notebook ↩︎
soon to be paused and then abandonned, no doubt ↩︎
that's the equinox link ↩︎
🎶pink floyd sounds🎶: is there anybody out there? ↩︎
Which is just
d3
wrapped in a slightly more ergonomic api ↩︎I also revisted the spreadsheets on NOAA's Solar Calculation Details page ↩︎