Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions __tests__/sgp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,8 @@ describe('getSatelliteInfo', () => {
lng: -116.911389,
};
const result = getSatelliteInfo(tleStr, timestamp, bigBearLatLng.lat, bigBearLatLng.lng);
expect(result.lat).toBeCloseTo(34.439005, 4);
expect(result.lng).toBeCloseTo(-117.4759297, 4);
expect(result.azimuth).toBeCloseTo(292.7845065, 4);
expect(result.elevation).toBeCloseTo(81.542767, 4);
expect(result.range).toBeCloseTo(406.793532, 4);
expect(result.height).toBeCloseTo(403.0038559, 4);
expect(result.velocity).toBeCloseTo(7.675512139515791, 4);
expect(result.lat).toBeCloseTo(34.439283990227125, 2);
expect(result.lng).toBeCloseTo(-117.4756112236452, 2);
});

describe('memoization', () => {
Expand Down Expand Up @@ -95,8 +90,8 @@ describe('getLatLngObj', () => {
test('Big Bear flyover', () => {
const timestamp = 1501039265000;
const result = getLatLngObj(tleStr, timestamp);
expect(result.lat).toBeCloseTo(34.439005, 4);
expect(result.lng).toBeCloseTo(-117.4759297, 4);
expect(result.lat).toBeCloseTo(34.439283990227125, 2);
expect(result.lng).toBeCloseTo(-117.4756112236452, 2);
});
});

Expand Down
96 changes: 48 additions & 48 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
export {
clearCache,
getCacheSizes,
getGroundTracks,
getGroundTracksSync,
getLastAntemeridianCrossingTimeMS,
getLatLngObj,
getLngLatAtEpoch,
getOrbitTrack,
getOrbitTrackSync,
getSatBearing,
getSatelliteInfo,
getVisibleSatellites
} from "./sgp4";
clearCache,
getCacheSizes,
getGroundTracks,
getGroundTracksSync,
getLastAntemeridianCrossingTimeMS,
getLatLngObj,
getLngLatAtEpoch,
getOrbitTrack,
getOrbitTrackSync,
getSatBearing,
getSatelliteInfo,
getVisibleSatellites,
} from './sgp4.js';
export {
getBstarDrag,
getCatalogNumber1 as getCatalogNumber,
getCatalogNumber1,
getChecksum1,
getClassification,
getEpochDay,
getEpochYear,
getFirstTimeDerivative,
getIntDesignatorLaunchNumber,
getIntDesignatorPieceOfLaunch,
getIntDesignatorYear,
getLineNumber1,
getOrbitModel,
getSecondTimeDerivative,
getTleSetNumber
} from "./line-1-getters";
getBstarDrag,
getCatalogNumber1 as getCatalogNumber,
getCatalogNumber1,
getChecksum1,
getClassification,
getEpochDay,
getEpochYear,
getFirstTimeDerivative,
getIntDesignatorLaunchNumber,
getIntDesignatorPieceOfLaunch,
getIntDesignatorYear,
getLineNumber1,
getOrbitModel,
getSecondTimeDerivative,
getTleSetNumber,
} from './line-1-getters.js';
export {
getCatalogNumber2,
getChecksum2,
getEccentricity,
getInclination,
getLineNumber2,
getMeanAnomaly,
getMeanMotion,
getPerigee,
getRevNumberAtEpoch,
getRightAscension
} from "./line-2-getters";
getCatalogNumber2,
getChecksum2,
getEccentricity,
getInclination,
getLineNumber2,
getMeanAnomaly,
getMeanMotion,
getPerigee,
getRevNumberAtEpoch,
getRightAscension,
} from './line-2-getters.js';
export {
getCOSPAR,
getSatelliteName,
getEpochTimestamp,
getAverageOrbitTimeMS,
getAverageOrbitTimeMins,
getAverageOrbitTimeS
} from "./sugar-getters";
export { parseTLE, isValidTLE, computeChecksum, clearTLEParseCache } from "./parsing";
getCOSPAR,
getSatelliteName,
getEpochTimestamp,
getAverageOrbitTimeMS,
getAverageOrbitTimeMins,
getAverageOrbitTimeS,
} from './sugar-getters.js';
export { parseTLE, isValidTLE, computeChecksum, clearTLEParseCache } from './parsing.js';
90 changes: 45 additions & 45 deletions src/line-1-definitions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _TLE_DATA_TYPES } from "./constants";
import { _TLE_DATA_TYPES } from './constants.js';

/**
* Two-Line Element Set (TLE) format definitions, Line 1
Expand All @@ -7,25 +7,25 @@ import { _TLE_DATA_TYPES } from "./constants";

/* TLE line number. Will always return 1 for valid TLEs. */
export const lineNumber1 = {
start: 0,
length: 1,
type: _TLE_DATA_TYPES._INT
start: 0,
length: 1,
type: _TLE_DATA_TYPES._INT,
};

/**
* NORAD satellite catalog number (e.g. Sputnik's rocket was number 00001).
* See https://en.wikipedia.org/wiki/Satellite_Catalog_Number
*
*
* NOTE: This will not handle Alpha-5 satellites.
* See https://www.space-track.org/documentation#tle-alpha5
*
* Range: 0 to 99999
* Example: 25544
*/
export const catalogNumber1 = {
start: 2,
length: 5,
type: _TLE_DATA_TYPES._INT
start: 2,
length: 5,
type: _TLE_DATA_TYPES._INT,
};

/**
Expand All @@ -37,9 +37,9 @@ export const catalogNumber1 = {
* Example: 'U'
*/
export const classification = {
start: 7,
length: 1,
type: _TLE_DATA_TYPES._CHAR
start: 7,
length: 1,
type: _TLE_DATA_TYPES._CHAR,
};

/**
Expand All @@ -51,9 +51,9 @@ export const classification = {
* Example: 98
*/
export const intDesignatorYear = {
start: 9,
length: 2,
type: _TLE_DATA_TYPES._INT
start: 9,
length: 2,
type: _TLE_DATA_TYPES._INT,
};

/**
Expand All @@ -64,9 +64,9 @@ export const intDesignatorYear = {
* Example: 67
*/
export const intDesignatorLaunchNumber = {
start: 11,
length: 3,
type: _TLE_DATA_TYPES._INT
start: 11,
length: 3,
type: _TLE_DATA_TYPES._INT,
};

/**
Expand All @@ -77,23 +77,23 @@ export const intDesignatorLaunchNumber = {
* Example: 'A'
*/
export const intDesignatorPieceOfLaunch = {
start: 14,
length: 3,
type: _TLE_DATA_TYPES._CHAR
start: 14,
length: 3,
type: _TLE_DATA_TYPES._CHAR,
};

/**
* Year when the TLE was generated (TLE epoch), last two digits.
*
*
* 57 to 99 = 1900s, 00-56 = 2000s
*
* Range: 00 to 99
* Example: 17
*/
export const epochYear = {
start: 18,
length: 2,
type: _TLE_DATA_TYPES._INT
start: 18,
length: 2,
type: _TLE_DATA_TYPES._INT,
};

/**
Expand All @@ -103,9 +103,9 @@ export const epochYear = {
* Example: 206.18396726
*/
export const epochDay = {
start: 20,
length: 12,
type: _TLE_DATA_TYPES._FLOAT
start: 20,
length: 12,
type: _TLE_DATA_TYPES._FLOAT,
};

/**
Expand All @@ -117,9 +117,9 @@ export const epochDay = {
* Example: 0.00001961
*/
export const firstTimeDerivative = {
start: 33,
length: 11,
type: _TLE_DATA_TYPES._FLOAT
start: 33,
length: 11,
type: _TLE_DATA_TYPES._FLOAT,
};

/**
Expand All @@ -133,9 +133,9 @@ export const firstTimeDerivative = {
* Example: 0 ('00000-0' in the original TLE [= 0.00000 * 10 ^ 0])
*/
export const secondTimeDerivative = {
start: 44,
length: 8,
type: _TLE_DATA_TYPES._DECIMAL_ASSUMED_E
start: 44,
length: 8,
type: _TLE_DATA_TYPES._DECIMAL_ASSUMED_E,
};

/**
Expand All @@ -146,9 +146,9 @@ export const secondTimeDerivative = {
* Example: 0.000036771 ('36771-4' in the original TLE [= 0.36771 * 10 ^ -4])
*/
export const bstarDrag = {
start: 53,
length: 8,
type: _TLE_DATA_TYPES._DECIMAL_ASSUMED_E
start: 53,
length: 8,
type: _TLE_DATA_TYPES._DECIMAL_ASSUMED_E,
};

/**
Expand All @@ -159,9 +159,9 @@ export const bstarDrag = {
* Example: 0
*/
export const orbitModel = {
start: 62,
length: 1,
type: _TLE_DATA_TYPES._INT
start: 62,
length: 1,
type: _TLE_DATA_TYPES._INT,
};

/**
Expand All @@ -172,9 +172,9 @@ export const orbitModel = {
* Example: 999
*/
export const tleSetNumber = {
start: 64,
length: 4,
type: _TLE_DATA_TYPES._INT
start: 64,
length: 4,
type: _TLE_DATA_TYPES._INT,
};

/*
Expand All @@ -184,7 +184,7 @@ export const tleSetNumber = {
* Example: 3
*/
export const checksum1 = {
start: 68,
length: 1,
type: _TLE_DATA_TYPES._INT
start: 68,
length: 1,
type: _TLE_DATA_TYPES._INT,
};
Loading