Skip to content

Commit

Permalink
fix: 🐛 fix math for getStarAzEl
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Aug 6, 2022
1 parent c90b70a commit 0a0ee9a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/utils/sun-math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,16 @@ export class SunMath {
const lw = -lon * DEG2RAD;
const phi = lat * DEG2RAD;
const d = SunMath.date2jSince2000(date);
const H = SunMath.siderealTime(d, lw) - (ra / 12) * Math.PI;
let h = SunMath.elevation(H, phi, (dec / 180) * Math.PI);
const H = SunMath.siderealTime(d, lw) - ra;

h += SunMath.astroRefraction(h); // elevation correction for refraction
let el = SunMath.elevation(H, phi, dec);
const az = SunMath.azimuth(H, phi, dec);

el += SunMath.astroRefraction(h); // elevation correction for refraction

return {
az: SunMath.azimuth(H, phi, (dec / 180) * Math.PI),
el: h,
az,
el,
};
}

Expand Down

0 comments on commit 0a0ee9a

Please sign in to comment.