Code Monkey home page Code Monkey logo

node-ephem's Introduction

node-ephem

Parse JPL DE planetary ephemerides and calculate the position of planets (and moon) at a given time.

This module is based on Project Pluto's code for calculating planetary positions from JPL ephemerides.

Required

This module uses publicly available planetery ephemeride files which can be downloaded from NASA's Jet Propulsion Laboratory FTP server. More information on which file to chose can be found here.

Usage

Require the module.

var ephem = require('node-ephem');

Load ephemerides which you downloaded, by providing a path to it:

var e430 = ephem.load('./eph/linux_p1550p2650.430');

Find Mars, relative to the Sun, at this instant:

var position = e430.find(ephem.bodies.MARS, ephem.bodies.SUN, ephem.julian(new Date));

Find RA/Dec of Neptune at this moment, adjusted for light-time:

var radec = ephem.equatorial(e430.observe(ephem.bodies.MERCURY, ephem.bodies.EARTH, ephem.julian(new Date)));

Functions

node-ephem exports:

Function Parameters Description
load path Load planetary ephemerides file, returns ephemeris object
julian date convert Date to Julian day (J2000 epoch, TT)
equatorial position Cartesian to Equаtorial

ephemeris object:

Function Parameters Description
find body, observer, time Find the position of body looking from observer at time
observe body, observer, time Find position of body adjusted for light-time
status Returns constants from loaded epehmeris file and status

Planets

node-ephem provides a convenient name to code mapping via exported constants

Planet Code
ephem.bodies.MERCURY 1
ephem.bodies.VENUS 2
ephem.bodies.EARTH 3
ephem.bodies.MARS 4
ephem.bodies.JUPITER 5
ephem.bodies.SATURN 6
ephem.bodies.URANUS 7
ephem.bodies.NEPTUNE 8
ephem.bodies.PLUTO 9
ephem.bodies.MOON 10
ephem.bodies.SUN 11

Testrunner

A testrunner is included which executes the test files available for DE files. Download the testpo file and place in the same directory as the ephemeris file, then run:

node testrunner.js

Follow the instructions.

node-ephem's People

Contributors

vukicevic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.