Skip to content

Commit

Permalink
Version 4.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezze committed Sep 14, 2020
2 parents 91f714d + aa682a2 commit 47c6a6b
Show file tree
Hide file tree
Showing 8 changed files with 2,945 additions and 2,460 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

### 4.1.0 (2020-09-14)

- TypeScript support is added via new TypeScript definitions file (#71).
- Rollup and some other dependencies are upgraded.

### 4.0.0 (2020-01-21)

- Node.js 12 support is added. Node.js 6 and Node.js 8 support is dropped (breaking change).
Expand All @@ -9,7 +14,7 @@
### 3.0.1 (2019-03-14)

- Unnecessary calculations in `sgp4` function are reduced (#47).
- `vkmpersec` calculation is moved to constants (#50).
- `vkmpersec` calculation is moved to constants (#50).
- `degreesToRadians` function is used in docs instead of `deg2rad` constant (#53).
- Typos' fixes (#54).

Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "satellite.js",
"version": "4.0.0",
"version": "4.1.0",
"description": "SGP4/SDP4 calculation library",
"main": "lib/index.js",
"jsnext:main": "dist/satellite.es.js",
"types": "types/index.d.ts",
"module": "dist/satellite.es.js",
"scripts": {
"build": "rimraf lib dist && npm run transpile && npm run dist",
Expand Down Expand Up @@ -40,29 +41,28 @@
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-json-strings": "^7.10.4",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/register": "^7.8.3",
"chokidar": "^3.3.1",
"copyfiles": "^2.2.0",
"coveralls": "^3.0.9",
"cross-env": "^6.0.3",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.0",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/preset-env": "^7.11.5",
"@babel/register": "^7.11.5",
"@rollup/plugin-babel": "^5.2.1",
"chokidar": "^3.4.2",
"copyfiles": "^2.3.0",
"coveralls": "^3.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.9.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0",
"glob": "^7.1.6",
"jest": "^24.9.0",
"prepend-file": "^1.3.1",
"rimraf": "^3.0.0",
"rollup": "^1.29.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-uglify": "^6.0.4",
"uglify-es": "^3.3.9"
"jest": "^26.4.2",
"prepend-file": "^2.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.26.11",
"rollup-plugin-terser": "^7.0.2"
},
"homepage": "https://github.com/shashwatak/satellite-js",
"directories": {
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.es.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import babel from 'rollup-plugin-babel';
import babel from '@rollup/plugin-babel';

export default {
input: 'src/index.js',
Expand All @@ -11,6 +11,7 @@ export default {
plugins: [
babel({
babelrc: false,
babelHelpers: 'bundled',
presets: [
['@babel/preset-env', { modules: false }],
],
Expand Down
10 changes: 5 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';

const { NODE_ENV } = process.env;

Expand All @@ -9,14 +8,15 @@ const external = Object.keys(globals);

const babelOptions = {
babelrc: false,
babelHelpers: 'bundled',
presets: [
['@babel/preset-env', { modules: false }],
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-class-properties', { loose: false }],
'@babel/plugin-proposal-json-strings'
'@babel/plugin-proposal-json-strings',
],
exclude: 'node_modules/**',
};
Expand All @@ -26,7 +26,7 @@ const plugins = [
];

if (NODE_ENV === 'production') {
plugins.push(uglify({}, minify));
plugins.push(terser());
}

export default {
Expand Down
8 changes: 3 additions & 5 deletions rollup.watch.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ config.watch = {
};

const watcher = watch(config);
watcher.on('event', event => {
watcher.on('event', (event) => {
if (event.code === 'START') {
console.log('Rebuilding package...');
}
else if (event.code === 'END') {
} else if (event.code === 'END') {
console.log('Package is rebuilt.');
}
else if (event.code === 'FATAL') {
} else if (event.code === 'FATAL') {
console.log('Fatal error is occurred.');
}
});
1 change: 0 additions & 1 deletion src/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export default function twoline2satrec(longstr1, longstr2) {
satrec.alta = (satrec.a * (1.0 + satrec.ecco)) - 1.0;
satrec.altp = (satrec.a * (1.0 - satrec.ecco)) - 1.0;


// ----------------------------------------------------------------
// find sgp4epoch time of element set
// remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)
Expand Down
199 changes: 199 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
declare module 'satellite.js' {
/**
* Satellite record containing description of orbit.
*/
export interface SatRec {
/**
* Unique satellite number given in the TLE file.
*/
satnum: string;
/**
* Full four-digit year of this element set's epoch moment.
*/
epochyr: number;
/**
* Fractional days into the year of the epoch moment.
*/
epochdays: number;
/**
* Julian date of the epoch (computed from epochyr and epochdays).
*/
jdsatepoch: number;
/**
* First time derivative of the mean motion (ignored by SGP4).
*/
ndot: number;
/**
* Second time derivative of the mean motion (ignored by SGP4).
*/
nddot: number;
/**
* Ballistic drag coefficient B* in inverse earth radii.
*/
bstar: number;
/**
* Inclination in radians.
*/
inclo: number;
/**
* Right ascension of ascending node in radians.
*/
nodeo: number;
/**
* Eccentricity.
*/
ecco: number;
/**
* Argument of perigee in radians.
*/
argpo: number;
/**
* Mean anomaly in radians.
*/
mo: number;
/**
* Mean motion in radians per minute.
*/
no: number;
}

/**
* Initialize a satellite record
*/
export function twoline2satrec(tleLine1: string, tleLine2: string): SatRec;

/**
* Coordinate frame Earth Centered Inertial (ECI)
* https://en.wikipedia.org/wiki/Earth-centered_inertial
*/
export interface EciVec3<T> {
x: T;
y: T;
z: T;
}

/**
* Coordinate frame Earth Centered Fixed (ECF)
* https://en.wikipedia.org/wiki/ECEF
*/
export interface EcfVec3<T> {
x: T;
y: T;
z: T;
}

/**
* Type alias documents units are kilometer (km)
*/
export type Kilometer = number;

/**
* Type alias documents units are kilometer per second (km/s)
*/
export type KilometerPerSecond = number;

/**
* The position_velocity result is a key-value pair of ECI coordinates.
* These are the base results from which all other coordinates are derived.
*/
export interface PositionAndVelocity {
position: EciVec3<Kilometer>;
velocity: EciVec3<KilometerPerSecond>;
}

/**
* Propagate satellite using time since epoch (in minutes).
*/
export function sgp4(satrec: SatRec, timeSinceTleEpochMinutes: number): PositionAndVelocity;

/**
* Propagate satellite using time as JavaScript Date.
*/
export function propagate(satrec: SatRec, date: Date): PositionAndVelocity;

/**
* Type alias documents units are radians
*/
export type Radians = number;

/**
* Type alias documents units are degrees
*/
export type Degrees = number;

/**
* Convert number in degrees to number in radians
* @param value Number to convert
*/
export function degreesToRadians(value: Degrees): Radians;

/**
* https://en.wikipedia.org/wiki/Geographic_coordinate_system#Latitude_and_longitude
*/
export interface GeodeticLocation {
longitude: Radians;
latitude: Radians;
height: Kilometer;
}

/**
* You will need GMST for some of the coordinate transforms.
* GMST - Greenwich Mean Sidereal Time
* http://en.wikipedia.org/wiki/Sidereal_time#Definition
*/
export type GMSTime = number;

/**
* Convert a date time to GMST
* @param date Time to convert
*/
export function gstime(date: Date): GMSTime;

/**
* Convert ECI to ECF. Units are not modified.
*/
export function eciToEcf<T>(positionEci: EciVec3<T>, gmst: GMSTime): EcfVec3<T>;

/**
* Convert geodetic location to ECF
*/
export function geodeticToEcf(observerGd: GeodeticLocation): EcfVec3<Kilometer>;

/**
* Convert ECI to geodetic location
*/
export function eciToGeodetic(positionEci: EciVec3<Kilometer>, gmst: GMSTime): GeodeticLocation;

/**
* https://en.wikipedia.org/wiki/Azimuth
*/
export interface LookAngles {
azimuth: Radians;
elevation: Radians;
rangeSat: Kilometer;
}

/**
* Convert ECF to look angles
*/
export function ecfToLookAngles(observerGd: GeodeticLocation, positionEcf: EcfVec3<Kilometer>): LookAngles;

/**
* Compute doppler factor between observer and satellite with position and velocity.
*/
export function dopplerFactor(
observerCoordsEcf: EcfVec3<Kilometer>,
positionEcf: EcfVec3<Kilometer>,
velocityEcf: EcfVec3<KilometerPerSecond>
): number;

/**
* Convert the longitude in RADIANS to DEGREES for pretty printing (appends "N", "S", "E", "W", etc).
*/
export function degreesLong(longitude: Radians): string;

/**
* Convert the latitude in RADIANS to DEGREES for pretty printing (appends "N", "S", "E", "W", etc).
*/
export function degreesLat(latitude: Radians): string;
}
Loading

0 comments on commit 47c6a6b

Please sign in to comment.