(date, lat, lng)
| 391 | } |
| 392 | |
| 393 | export function getMoonPosition(date, lat, lng) { |
| 394 | const lw = rad * -lng; |
| 395 | const phi = rad * lat; |
| 396 | const d = toDays(date); |
| 397 | const c = moonCoords(toDaysTT(d)); // position series run on Terrestrial Time |
| 398 | const H = siderealTime(d, lw) - c.ra; // sidereal time stays on UT |
| 399 | |
| 400 | // geocentric parallax (Meeus ch.40) lowers the moon along its vertical circle, leaving |
| 401 | // azimuth unchanged; sin(parallax) = (Earth radius / distance) * cos(geocentric altitude). |
| 402 | const hGeo = altitude(H, phi, c.dec); |
| 403 | const h = hGeo - asin(earthRadius / c.dist * cos(hGeo)); |
| 404 | |
| 405 | // parallactic angle, Meeus 14.1 |
| 406 | const pa = atan(sin(H), tan(phi) * cos(c.dec) - sin(c.dec) * cos(H)); |
| 407 | |
| 408 | return { |
| 409 | azimuth: azimuth(H, phi, c.dec), |
| 410 | // apparent (refraction-corrected) altitude in degrees |
| 411 | altitude: (h + astroRefraction(h)) / rad, |
| 412 | distance: c.dist, |
| 413 | parallacticAngle: pa / rad |
| 414 | }; |
| 415 | } |
| 416 | |
| 417 | // moon illumination parameters, Meeus ch. 48 (and idlastro's mphase.pro) |
| 418 | export function getMoonIllumination(date = new Date()) { |
no test coverage detected
searching dependent graphs…