Published
Edited
Oct 17, 2020
1 star
Insert cell
Insert cell
Insert cell
latitude = -37.819982
Insert cell
longitude = 144.983431
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
datetime = moment.parseZone(`${d}T${t}${utc}`)
Insert cell
EPOCH_DAY = datetime.hours(0).minutes(0).seconds(0)
Insert cell
Insert cell
Insert cell
JD = (EPOCH_DAY / 86400000) + 2440587.5
Insert cell
Insert cell
Insert cell
T = (JD - 2451545.0) / 36525
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
L = 280.46646 + 36000.76983 * T + 0.0003032 * T**2
Insert cell
Insert cell
M = 357.52911 + 35999.05029 * T + 0.0000001537 * T**2
Insert cell
Insert cell
e = 0.016708634 - 0.000042037 * T - 0.0000001267 * T**2
Insert cell
Insert cell
C = (1.914602 - 0.004817 * T - 0.000014 * T ** 2) * sin(M) + (0.019993 - 0.000101 * T) * sin(2 * M) + 0.000289 * sin(3 * M)
Insert cell
Insert cell
sol = L + C
Insert cell
Insert cell
v = M + C
Insert cell
Insert cell
R = (1.000001018 * (1 - e ** 2)) / (1 + e * cos(v))
Insert cell
Insert cell
λ = sol - 0.00569 - 0.00478 * sin(125.04 - 1934.136 * T)
Insert cell
Insert cell
ε = 23 + 26 / 60 + 21.448 / 3600 - 46.8150 * T / 3600 - 0.00059 * T**2 / 3600 + 0.00183 * T**3 / 3600 + 0.00256 * cos(125.04 - 1934.136 * T)
Insert cell
Insert cell
α = deg(Math.atan2(cos(ε) * sin(λ), cos(λ)))
Insert cell
Insert cell
δ = deg(Math.asin(sin(ε) * sin(λ)))
Insert cell
Insert cell
Insert cell
Ω = 125.04452 - 1934.136261 * T + 0.0020708 * T**2 + T**3 / 450000
Insert cell
Insert cell
Δψ = -17.1196 * sin(Ω) - -1.3187 * sin(2 * (280.4665 + 36000.7698 * T)) - 0.2274 * sin(2 * (218.3165 + 481267.8813 * T)) + 0.2062 * sin(2 * Ω)
Insert cell
Insert cell
Insert cell
θ = 100.46061837 + 36000.770053608 * T + 0.000387933 * T**2 - T**3 / 38710000 - Δψ * cos(ε) / 15
Insert cell
Insert cell
H = (θ - longitude - α) % 360
Insert cell
Insert cell
Insert cell
az = 180 - deg(Math.atan2(sin(H), cos(H) * sin(latitude) - tan(δ) * cos(latitude)))
Insert cell
alt = deg(Math.asin(sin(latitude) * sin(δ) + cos(latitude) * cos(δ) * cos(H)))
Insert cell
Insert cell
sin = (x) => Math.sin(rad(x))
Insert cell
cos = (x) => Math.cos(rad(x))
Insert cell
tan = (x) => Math.tan(rad(x))
Insert cell
deg = (r) => r * 180 / Math.PI
Insert cell
rad = (d) => d * Math.PI / 180
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more