New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-ephem

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ephem

Calculator/parser for JPL ephemeris data

latest
Source
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

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:

FunctionParametersDescription
loadpathLoad planetary ephemerides file, returns ephemeris object
juliandateconvert Date to Julian day (J2000 epoch, TT)
equatorialpositionCartesian to Equаtorial

ephemeris object:

FunctionParametersDescription
findbody, observer, timeFind the position of body looking from observer at time
observebody, observer, timeFind position of body adjusted for light-time
statusReturns constants from loaded epehmeris file and status

Planets

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

PlanetCode
ephem.bodies.MERCURY1
ephem.bodies.VENUS2
ephem.bodies.EARTH3
ephem.bodies.MARS4
ephem.bodies.JUPITER5
ephem.bodies.SATURN6
ephem.bodies.URANUS7
ephem.bodies.NEPTUNE8
ephem.bodies.PLUTO9
ephem.bodies.MOON10
ephem.bodies.SUN11

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.

FAQs

Package last updated on 16 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts