3.0.1 • Published 5 years ago

kepler-utils v3.0.1

Weekly downloads
16
License
MIT
Repository
github
Last release
5 years ago

npm.io npm.io npm.io npm.io npm.io npm.io

Kepler Utils

This node package uses JPL's Keplerian Elements for Aproximation of the Major Planets to calculate the heliocentric positions of the planets in our solar system for a given date. It provides a set of tools for converting Gregorian dates to Julian dates as well as calculating the positions of the planets.

Getting Started

Follow the instructions below to get this module up and running on your sytstem

Prerequisites

You will need to have the NodeJS environment installed on your machine if you want to use the NodeJS Package Manager to install this project.

Installing

You can add this package to your project by running

$ npm install kepler-utils

You can also clone this project if you want to use it without NodeJS

$ git clone https://github.com/popnfresh234/kepler-utils.git

Usage

First, require the module in your project

const KeplerUtils = require('kepler-utils');

The KeplerUtils project contains two helper modules, JulianUtils for converting dates and OrbitalUtils for calculating orbital positions.

Typical usage would be to calculate the orbital positions of a planet at a given date. For this we make use of the OrbitalUtils module. The OribtalUtils module provides a method that takes a planet object provided by KeplerUtils and the number of centuries since the J2000 reference frame. The number of centuries since J2000 is given by a helper method in the JulianUtils module.

const SolarSystem = const SolarSystem = KeplerUtils.SolarSystem;
const julianDate = KeplerUtils.getJulianDate('1985/04/30');
const centuriesSinceJ2000 = KeplerUtils.Julianutils.getCenturiesSincej2000(julianDate);
const marsPosition = KeplerUtils.OrbitalUtils.calcOrbitals(SolarSystem.mars, centuriesSinceJ2000);

JulianUtils Functions

getJulianDate ( gregorianDate )

Takes a Gregorian date in the format YYYY/MM/DD and returns the equivalent Julian Date

getGregorianDate ( julianDate )

Takes a Julian date and returns a Date object for that day.

getJ2000 ()

Returns the Julian date for the J2000 reference date of 2000/1/1

getCenturiesSinceJ2000 ( gregorianDate )

Takes a Gregorian date in the format YYYY/MM/DD and returns the numbers of centuries elapsed since J2000.

OrbitalUtils Functions

calcOrbitals ( planet, centuriesSinceJ2000 )

Takes a Planet object provided by KeplerUtils.SolarSystem and the number of centuries elapsed since J2000 provided by KeplerUtils.JulianUtils and returns an object with data about the given planets position in space.

Typical output is as follows:

{
  a: 1.5237076300553047,
  e: 0.09338253541738535,
  i: 1.850884457379603,
  L: 67.15410829602524,
  lPeri: 335.9911658129864,
  lAscNode: 49.60246570018125,
  M: 91.16294248303882,
  eccAnom: 96.479194,
  trueAnom: 101.77532685909541,
  b: 1.5170494907935048,
  helioCentricCoords:
     {
       x: 0.3265591021725068,
       y: 1.50455324006384,
       z: 0.023473333963656553,
     },
};

The keys of the returned object is as follows:

KeyPropertyUnits
asemi-major axisau
eeccentricityunitless
iinclinationdegrees
Lmean longitudedegrees
lPerilongitude of periheliondegrees
lAscNodelongitude of ascending nodedegrees
Mmean anomalydegrees
eccAnomeccentric anomalydegrees
trueAnomtrue anomalydegrees
bsemi minor axisau
heliocentricCoordsrectangular coords of plaentsau

This data can then be used to plot the positions of the planets for whatever use case you may have.

getPlutoFullOrbit ()

This method returns an [] of objects containing rectangular coordinates for an entire period of Pluto's orbit. As Pluto's orbit doesn't fit a perfect ellipse well, we can make use of these points to manually plot the path of Pluto's orbit for dispaly purposes.

An example of the output of this function is as follow:

[ 
  { x: -20.256870769288906,
    y: -20.126040799230992,
    z: 8.01303272889247 },
  { x: -20.209017036396666,
    y: -20.177347181609036,
    z: 8.004682070653734 },
    ...
]

Versioning

This project uses SemVer for versioning.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

The following resources were indispensable for creating this project

3.0.1

5 years ago

3.0.0

5 years ago

1.2.0

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago