npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

meeusjs

v1.0.4

Published

Implementation of the Astronomical Algorithms of Jean Meeus in Javascript

Downloads

161

Readme

MeeusJs

MeeusJs is an implementation of some algorithms of the Book 'Astronomical Algorithms of Jean Meeus' in Javascript. It follows the second edition, copyright 1998, with corrections as of August 10, 2009.

The library can be used to calculate sun and moon positions and their phases (rise, transmit, set) on a high accuracy.

The library is about 20kb (minimized) and licensed under MIT. It includes various unit tests against the data of http://ssd.jpl.nasa.gov/horizons.cgi.

The sourcecode is written by Fabio Soldati (@fabiz) from http://www.peakfinder.org.

Package contents

Currently the following chapters are implemented:

| Chapter | Module | | ---------------------------------------------------- |:-------------:| |3. Interpolation | A.Interp | |7. Julian Day | A.JulianDay | |10. Dynamical Time and Universal Time | A.DeltaT | |11. The Earth's Globe | A.Globe | |12. Sidereal Time at Greenwich | A.Sidereal | |13. Transformation of Coordinates | A.Coord | |14. The Parallactic Angle, and three other Topics | A.Moon | |15. Rising, Transit, and Setting | A.Rise | |16. Atmospheric Refraction | A.Refraction | |22. Nutation and the Obliquity of the Ecliptic | A.Nutation | |23. Apparent Place of a Star | A.Nutation | |25. Solar Coordinates | A.Solar | |27. Equinoxes and Solstices | A.Solstice | |40. Correction for Parallax | A.Parallax | |47. Position of the Moon | A.Moon | |48. Illuminated Fraction of the Moon's Disk | A.MoonIllum | |49. Phases of the Moon | A.MoonPhase |

Usage example

Sun


// gets sun position and times for zurich
var jdo = new A.JulianDay(new Date()); // now
var coord = A.EclCoord.fromWgs84(47.3957, 8.4867, 440); // zurich

// gets the position of the sun		
var tp = A.Solar.topocentricPosition(jdo, coord, true);
// print azi and alt
console.log(tp.hz.toString()); 

// gets the rise, transit and set time of the sun for today
var times = A.Solar.times(jdo, coord);
	
// print rise, transit and set in universal time	
console.log("rise:" + A.Coord.secondsToHMSStr(times.rise) + 
          ", transit:" + A.Coord.secondsToHMSStr(times.transit) + 
          ", set:" +  A.Coord.secondsToHMSStr(times.set));

Moon


// gets the moon position and times for zurich
var jdo = new A.JulianDay(new Date()); // now
var coord = A.EclCoord.fromWgs84(47.3957, 8.4867, 440); // zurich

// gets the position of the moon		
var tp = A.Moon.topocentricPosition(jdo, coord, true);
// print azi and alt
console.log(tp.hz.toString() + ", dist:" + tp.delta); 

// gets the rise, transit and set time of the moon for today
var times = A.Moon.times(jdo, coord);
	
// print rise, transit and set in universal time	
console.log("rise:" + A.Coord.secondsToHMSStr(times.rise) + 
          ", transit:" + A.Coord.secondsToHMSStr(times.transit) + 
          ", set:" +  A.Coord.secondsToHMSStr(times.set));
		  

// print moon phase and illuminated
var suneq = A.Solar.apparentTopocentric(jdo, coord);
var i = A.MoonIllum.phaseAngleEq2(tp.eq, suneq);
var k = A.MoonIllum.illuminated(i);
var chi =  A.MoonIllum.positionAngle(moontp.eq, suneq);

console.log("phase:" + i + ", illuminated:" + k + ", angle:" + chi);		

Changelog

1.0.3 — Jan 18, 2017

  • Fixed bug on A.JulianDay.jdToDate

1.0.2 — Mar 18, 2016

  • Added solistice

1.0.1 — Mar 04, 2016

  • Fixed bug of MoonIllum
  • Added approxTransit to Moon and Solar
  • Added toDate method the JulianDay

1.0.0 — Mar 02, 2016

  • First commit.