Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
v2.0.3: bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay LaPorte committed Apr 4, 2019
1 parent 9aefcc3 commit 0a989e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions lib/solar.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,17 @@ class Time {
}

hour_angle(lon) {
return sidereal.local(julian.to(this.time), lon) - this.right_ascension;
return sidereal.local(julian.to(this.time), lon * RAD) - this.right_ascension;
}

observer(lat, lon) {
lat *= RAD;
lon *= RAD;

// https://en.wikipedia.org/wiki/Hour_angle
const hour_angle = this.hour_angle(lon);

// Solar elevation angle.
// https://en.wikipedia.org/wiki/Solar_zenith_angle
const sin_lat = Math.sin(lat);
const cos_lat = Math.cos(lat);
const sin_lat = Math.sin(lat * RAD);
const cos_lat = Math.cos(lat * RAD);
const sin_dec = this.sin_declination;
const cos_dec = Math.sqrt(1 - sin_dec * sin_dec);
return new Location(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "2.0.2",
"version": "2.0.3",
"description": "Solar and lunar position calculations",
"main": "index.js",
"devDependencies": {
Expand Down

0 comments on commit 0a989e4

Please sign in to comment.