diff --git a/examples/commonjs/README.md b/examples/commonjs/README.md index 2c6a8ac..b9d9208 100644 --- a/examples/commonjs/README.md +++ b/examples/commonjs/README.md @@ -1,3 +1,3 @@ Run the examples using node. -Example: node ./examples/commonjs/satellite.js +Example: node ./examples/commonjs/satellite-js-migration.js diff --git a/examples/commonjs/satellite-js-migration.js b/examples/commonjs/satellite-js-migration.js index fcf22e1..f85218e 100644 --- a/examples/commonjs/satellite-js-migration.js +++ b/examples/commonjs/satellite-js-migration.js @@ -1,8 +1,11 @@ -const { Satellite, Sgp4, GroundPosition, calcGmst } = require('../../lib/ootk-core'); +const { Satellite, Sgp4, GroundPosition, calcGmst, DEG2RAD } = require('../../commonjs/index.js'); + +// Example Date +const exampleDate = new Date(1705109326817); // Sample TLE -const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992'; -const tle2 = '2 25544 51.6433 59.2583 0008217 16.4489 347.6017 15.51174618173442'; +const tle1 = '1 56006U 23042W 24012.45049317 .00000296 00000-0 36967-4 0 9992'; +const tle2 = '2 56006 43.0043 13.3620 0001137 267.5965 92.4747 15.02542972 44491'; // Initialize a Satellite Object const satellite = new Satellite({ @@ -26,8 +29,8 @@ const velocityEci = positionAndVelocity.velocity; // Set the Observer at 122.03 West by 36.96 North, in DEGREES (because who likes working in radians?) const observer = new GroundPosition({ - lon: -122.0308, - lat: 36.9613422, + lon: -71.0308, + lat: 41.9613422, alt: 0.37, }); @@ -37,14 +40,17 @@ const { gmst, j } = calcGmst(new Date()); // You can get ECF, Geodetic, Look Angles, and Doppler Factor. const positionEcf = satellite.ecf(); const observerEcf = observer.ecf(); -const positionGd = satellite.lla(); -const lookAngles = satellite.rae(observer); +const positionGd = satellite.lla(exampleDate); +const lookAngles = satellite.rae(observer, exampleDate); // This never worked in satellite.js, but it does now! -const dopplerFactor = satellite.dopplerFactor(observer); +const uplinkFreq = 420e6; +const dopplerFactor = satellite.dopplerFactor(observer, exampleDate); +let dopplerShiftedFrequency = uplinkFreq * dopplerFactor; +dopplerShiftedFrequency = satellite.applyDoppler(uplinkFreq, observer, exampleDate); // The coordinates are all stored in strongly typed key-value pairs. // ECI and ECF are accessed by `x`, `y`, `z` properties. -const position = satellite.eci().position; +const position = satellite.eci(exampleDate).position; const satelliteX = position.x; const satelliteY = position.y; const satelliteZ = position.z; @@ -69,3 +75,31 @@ const latitudeRad = latitude * DEG2RAD; // There is no need to use the units seen in TypeScript examples. // const longitudeRad = (longitude * DEG2RAD) as Radians; // const latitudeRad = (latitude * DEG2RAD) as Radians; + +console.log('Satellite.js Migration Example'); +console.log('======================================'); +console.log('TLE: ', tle1); +console.log(' ', tle2); +console.log('======================================'); +console.log('Position (ECI):'); +console.log(' x: ', satelliteX); +console.log(' y: ', satelliteY); +console.log(' z: ', satelliteZ); +console.log('Position (ECF):'); +console.log(' x: ', positionEcf.x); +console.log(' y: ', positionEcf.y); +console.log(' z: ', positionEcf.z); +console.log('Position (Geodetic):'); +console.log(' longitude: ', longitude); +console.log(' latitude: ', latitude); +console.log(' height: ', height); +console.log('Look Angles:'); +console.log(' azimuth: ', azimuthDegrees); +console.log(' elevation: ', elevationDegrees); +console.log(' rangeSat: ', rangeSat); +console.log(' rangeRate: ', rangeRate); +console.log('Doppler Factor:'); +console.log(' dopplerFactor: ', dopplerFactor); +dopplerShiftedFrequency = dopplerShiftedFrequency / 1e6; // Hz to MHz +console.log(' 420MHz: ', `${dopplerShiftedFrequency.toPrecision(6)} MHz`); +console.log('======================================'); diff --git a/examples/mjs/satellite-js-migration.mjs b/examples/mjs/satellite-js-migration.mjs index 16c26ed..60082ce 100644 --- a/examples/mjs/satellite-js-migration.mjs +++ b/examples/mjs/satellite-js-migration.mjs @@ -1,8 +1,11 @@ -import { calcGmst, GroundPosition, Satellite, Sgp4 } from '../../lib/ootk-core'; +import { calcGmst, GroundPosition, Satellite, Sgp4 } from '../../lib/index.mjs'; + +// Example Date +const exampleDate = new Date(1705109326817); // Sample TLE -const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992'; -const tle2 = '2 25544 51.6433 59.2583 0008217 16.4489 347.6017 15.51174618173442'; +const tle1 = '1 56006U 23042W 24012.45049317 .00000296 00000-0 36967-4 0 9992'; +const tle2 = '2 56006 43.0043 13.3620 0001137 267.5965 92.4747 15.02542972 44491'; // Initialize a Satellite Object const satellite = new Satellite({ @@ -26,8 +29,8 @@ const velocityEci = positionAndVelocity.velocity; // Set the Observer at 122.03 West by 36.96 North, in DEGREES (because who likes working in radians?) const observer = new GroundPosition({ - lon: -122.0308, - lat: 36.9613422, + lon: -71.0308, + lat: 41.9613422, alt: 0.37, }); @@ -37,14 +40,17 @@ const { gmst, j } = calcGmst(new Date()); // You can get ECF, Geodetic, Look Angles, and Doppler Factor. const positionEcf = satellite.ecf(); const observerEcf = observer.ecf(); -const positionGd = satellite.lla(); -const lookAngles = satellite.rae(observer); +const positionGd = satellite.lla(exampleDate); +const lookAngles = satellite.rae(observer, exampleDate); // This never worked in satellite.js, but it does now! -const dopplerFactor = satellite.dopplerFactor(observer); +const uplinkFreq = 420e6; +const dopplerFactor = satellite.dopplerFactor(observer, exampleDate); +let dopplerShiftedFrequency = uplinkFreq * dopplerFactor; +dopplerShiftedFrequency = satellite.applyDoppler(uplinkFreq, observer, exampleDate); // The coordinates are all stored in strongly typed key-value pairs. // ECI and ECF are accessed by `x`, `y`, `z` properties. -const position = satellite.eci().position; +const position = satellite.eci(exampleDate).position; const satelliteX = position.x; const satelliteY = position.y; const satelliteZ = position.z; @@ -69,3 +75,31 @@ const latitudeRad = latitude * DEG2RAD; // There is no need to use the units seen in TypeScript examples. // const longitudeRad = (longitude * DEG2RAD) as Radians; // const latitudeRad = (latitude * DEG2RAD) as Radians; + +console.log('Satellite.js Migration Example'); +console.log('======================================'); +console.log('TLE: ', tle1); +console.log(' ', tle2); +console.log('======================================'); +console.log('Position (ECI):'); +console.log(' x: ', satelliteX); +console.log(' y: ', satelliteY); +console.log(' z: ', satelliteZ); +console.log('Position (ECF):'); +console.log(' x: ', positionEcf.x); +console.log(' y: ', positionEcf.y); +console.log(' z: ', positionEcf.z); +console.log('Position (Geodetic):'); +console.log(' longitude: ', longitude); +console.log(' latitude: ', latitude); +console.log(' height: ', height); +console.log('Look Angles:'); +console.log(' azimuth: ', azimuthDegrees); +console.log(' elevation: ', elevationDegrees); +console.log(' rangeSat: ', rangeSat); +console.log(' rangeRate: ', rangeRate); +console.log('Doppler Factor:'); +console.log(' dopplerFactor: ', dopplerFactor); +dopplerShiftedFrequency = dopplerShiftedFrequency / 1e6; // Hz to MHz +console.log(' 420MHz: ', `${dopplerShiftedFrequency.toPrecision(6)} MHz`); +console.log('======================================'); diff --git a/examples/typescript/satellite-js-migration.ts b/examples/typescript/satellite-js-migration.ts index 1ab33f3..72a5ab3 100644 --- a/examples/typescript/satellite-js-migration.ts +++ b/examples/typescript/satellite-js-migration.ts @@ -12,7 +12,7 @@ import { Sgp4, TleLine1, TleLine2, -} from '../../src/ootk-core'; +} from '../../src/index'; // Sample TLE const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992' as TleLine1; diff --git a/examples/typescript/sun.ts b/examples/typescript/sun.ts index 82d8515..eb8a2fd 100644 --- a/examples/typescript/sun.ts +++ b/examples/typescript/sun.ts @@ -1,4 +1,4 @@ -import { Degrees, Meters, Sun } from '../../lib/ootk-core'; +import { Degrees, Meters, Sun } from '../../lib/index'; /* eslint-disable no-console */ console.log(Sun.getTimes(new Date(), 41 as Degrees, -71 as Degrees, 0 as Meters)); diff --git a/examples/typescript/tle.ts b/examples/typescript/tle.ts index 77e8dc0..8d03582 100644 --- a/examples/typescript/tle.ts +++ b/examples/typescript/tle.ts @@ -2,7 +2,7 @@ /* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { Tle, TleLine1, TleLine2 } from '../../lib/ootk-core'; +import { Tle, TleLine1, TleLine2 } from '../../lib/index'; // Sample TLE const tle1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992' as TleLine1; diff --git a/package.json b/package.json index dc8fa8d..bdca66a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0-1", "description": "Orbital Object Toolkit Core including SGP4 Propagator and Coordinate Transforms", "scripts": { - "mjs": "ttsc -p tsconfig.build.json -m esnext", + "mjs": "ttsc -p tsconfig.build.json -m esnext && node ./scripts/makeMjs.mjs", "cjs": "ttsc -p tsconfig.c.json -m commonjs", "build": "node ./scripts/cleanup.mjs && npm run mjs && npm run cjs", "lint": "eslint src", @@ -57,4 +57,4 @@ "typescript-transform-paths": "^3.4.6" }, "homepage": "https://github.com/thkruz/ootk" -} +} \ No newline at end of file diff --git a/scripts/cleanup.mjs b/scripts/cleanup.mjs index 7668396..fd22fee 100644 --- a/scripts/cleanup.mjs +++ b/scripts/cleanup.mjs @@ -1,9 +1,16 @@ +/* eslint-disable no-console */ import rimraf from 'rimraf'; -// eslint-disable-next-line no-console console.log('Removing ./lib...'); try { rimraf.sync('./lib'); } catch (error) { // Intentionally left blank } + +console.log('Removing ./commonjs...'); +try { + rimraf.sync('./commonjs'); +} catch (error) { + // Intentionally left blank +} diff --git a/scripts/makeMjs.mjs b/scripts/makeMjs.mjs new file mode 100644 index 0000000..74b8d0f --- /dev/null +++ b/scripts/makeMjs.mjs @@ -0,0 +1,5 @@ +import { cpSync } from 'fs'; + +cpSync('./lib/index.js', './lib/index.mjs'); +cpSync('./lib/index.js.map', './lib/index.mjs.map'); +cpSync('./lib/index.d.ts', './lib/index.d.mts'); diff --git a/scripts/moveMjs.mjs b/scripts/moveMjs.mjs deleted file mode 100644 index 6be9a5f..0000000 --- a/scripts/moveMjs.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import { cpSync, renameSync } from 'fs'; - -renameSync('./lib/index.js', './lib/index.mjs'); -renameSync('./lib/index.js.map', './lib/index.mjs.map'); -cpSync('./lib/index.d.ts', './lib/index.d.mts'); diff --git a/src/body/Celestial.ts b/src/body/Celestial.ts index 7642722..dc5f998 100644 --- a/src/body/Celestial.ts +++ b/src/body/Celestial.ts @@ -1,4 +1,4 @@ -import { AzEl, Degrees, RaDec, Radians } from '..'; +import { AzEl, Degrees, Kilometers, RaDec, Radians } from '..'; import { RAD2DEG } from '../utils/constants'; import { Sun } from './Sun'; @@ -11,6 +11,7 @@ export class Celestial { const c: RaDec = { ra, dec, + dist: 0 as Kilometers, }; const azEl = Sun.azEl(date, lat, lon, c); diff --git a/src/body/Moon.ts b/src/body/Moon.ts index 2f2ab9d..ff7fe8b 100644 --- a/src/body/Moon.ts +++ b/src/body/Moon.ts @@ -223,7 +223,7 @@ export class Moon { */ const next = Math.min(nextNewMoon, nextFirstQuarter, nextFullMoon, nextThirdQuarter); // eslint-disable-next-line init-declarations - let phase; + let phase: (typeof Moon.moonCycles_)[0] | null = null; for (const moonCycle of Moon.moonCycles_) { if (phaseValue >= moonCycle.from && phaseValue <= moonCycle.to) { @@ -232,6 +232,10 @@ export class Moon { } } + if (!phase) { + throw new Error('Moon phase not found'); + } + let type = ''; if (next === nextNewMoon) { @@ -315,12 +319,12 @@ export class Moon { const { rise, set, ye } = Moon.calculateRiseSetTimes_(date, lat, lon); const result = { - rise: null, - set: null, - ye: null, - alwaysUp: null, - alwaysDown: null, - highest: null, + rise: NaN as Date | number, + set: NaN as Date | number, + ye: null as number | null, + alwaysUp: null as boolean | null, + alwaysDown: null as boolean | null, + highest: null as Date | null, }; if (rise) { diff --git a/src/body/Sun.ts b/src/body/Sun.ts index 09d93ff..9ddd161 100644 --- a/src/body/Sun.ts +++ b/src/body/Sun.ts @@ -287,18 +287,20 @@ export class Sun { const result = { solarNoon: Sun.julian2date(Jnoon), nadir: Sun.julian2date(Jnoon + 0.5), // https://github.com/mourner/suncalc/pull/125 - }; + } as SunTime; // Add all other unique times using Jnoon as a reference for (let i = 0, len = Sun.times_.length; i < len; i += 1) { time = Sun.times_[i]; - h0 = ((time[0] + dh) * DEG2RAD); + const angle = time[0] as Degrees; + + h0 = ((angle + dh) * DEG2RAD); Jset = Sun.getSetJ_(h0, lw, phi, dec, n, M, L); Jrise = Jnoon - (Jset - Jnoon); - result[time[1]] = Sun.julian2date(Jrise); - result[time[2]] = Sun.julian2date(Jset); + result[time[1] as string] = Sun.julian2date(Jrise); + result[time[2] as string] = Sun.julian2date(Jset); } return result; @@ -481,6 +483,7 @@ export class Sun { return { dec: Celestial.declination(L, 0), ra: Celestial.rightAscension(L, 0), + dist: 0 as Kilometers, }; } diff --git a/src/coordinate/TLE.ts b/src/coordinate/TLE.ts index bf9a63f..c10e337 100644 --- a/src/coordinate/TLE.ts +++ b/src/coordinate/TLE.ts @@ -25,9 +25,9 @@ * DEALINGS IN THE SOFTWARE. */ +import { ClassicalElements, FormatTle, TEME } from '.'; import { Sgp4, Vector3D } from '..'; import { Earth } from '../body'; -import { ClassicalElements, FormatTle, TEME } from '../coordinate'; import { Sgp4OpsMode } from '../enums/Sgp4OpsMode'; import { Sgp4GravConstants } from '../sgp4/sgp4'; import { EpochUTC } from '../time/EpochUTC'; @@ -945,7 +945,9 @@ export class Tle { const values = sccNum.toUpperCase().split(''); if (values[0] in Tle.alpha5_) { - values[0] = Tle.alpha5_[values[0]]; + const firstLetter = values[0] as keyof typeof Tle.alpha5_; + + values[0] = Tle.alpha5_[firstLetter]; } return values.join(''); diff --git a/src/coordinate/index.ts b/src/coordinate/index.ts index 4d2718c..94a13e0 100644 --- a/src/coordinate/index.ts +++ b/src/coordinate/index.ts @@ -9,4 +9,4 @@ export * from './RelativeState'; export * from './RIC'; export * from './StateVector'; export * from './TEME'; -export * from './TLE'; +export * from './Tle'; diff --git a/src/objects/BaseObject.ts b/src/objects/BaseObject.ts index 5206885..dae16ba 100644 --- a/src/objects/BaseObject.ts +++ b/src/objects/BaseObject.ts @@ -26,11 +26,11 @@ * DEALINGS IN THE SOFTWARE. */ -import { BaseObjectParams } from 'src/interfaces/BaseObjectParams'; +import { BaseObjectParams } from '../interfaces/BaseObjectParams'; import { EciVec3, Kilometers, SpaceObjectType } from '../types/types'; export class BaseObject { - id: number; // Unique ID + id?: number; // Unique ID name: string; type: SpaceObjectType; position: EciVec3; // Where is the object @@ -40,24 +40,25 @@ export class BaseObject { active = true; // Is the object active constructor(info: BaseObjectParams) { - this.type = info.type || SpaceObjectType.UNKNOWN; - this.name = info.name || 'Unknown'; + this.type = info.type ?? SpaceObjectType.UNKNOWN; + this.name = info.name ?? 'Unknown'; this.id = info.id; - this.active = info.active; + this.active = info.active ?? true; - this.position = info.position || { + this.position = info.position ?? { x: 0, y: 0, z: 0, }; // Default to the center of the earth until position is calculated - this.velocity = info.velocity || { + this.velocity = info.velocity ?? { x: 0, y: 0, z: 0, }; // Default to 0 velocity until velocity is calculated + this.totalVelocity = Math.sqrt(this.velocity.x ** 2 + this.velocity.y ** 2 + this.velocity.z ** 2); - this.time = info.time || new Date(); + this.time = info.time ?? new Date(); } /** @@ -169,6 +170,6 @@ export class BaseObject { [SpaceObjectType.ENGINE_MANUFACTURER]: 'Engine Manufacturer', }; - return typeToStringMap[this.type] || 'Unknown'; + return typeToStringMap[this.type] ?? 'Unknown'; } } diff --git a/src/objects/GroundPosition.ts b/src/objects/GroundPosition.ts index d5f7ad8..a1edb29 100644 --- a/src/objects/GroundPosition.ts +++ b/src/objects/GroundPosition.ts @@ -16,9 +16,9 @@ export class GroundPosition extends BaseObject { super(info); this.validateInputData_(info); - Object.keys(info).forEach((key) => { - this[key] = info[key]; - }); + this.lat = info.lat; + this.lon = info.lon; + this.alt = info.alt; } isSensor(): boolean { @@ -65,10 +65,10 @@ export class GroundPosition extends BaseObject { } private validateParameter_(value: T, minValue: T, maxValue: T, errorMessage: string): void { - if (minValue !== null && value < minValue) { + if (minValue && value < minValue) { throw new Error(errorMessage); } - if (maxValue !== null && value > maxValue) { + if (maxValue && value > maxValue) { throw new Error(errorMessage); } } diff --git a/src/objects/Satellite.ts b/src/objects/Satellite.ts index 5e8d8a5..d40b9c4 100644 --- a/src/objects/Satellite.ts +++ b/src/objects/Satellite.ts @@ -28,13 +28,13 @@ * SOFTWARE. */ -import { OptionsParams } from 'src/interfaces/OptionsParams'; -import { SatelliteParams } from 'src/interfaces/SatelliteParams'; import { Geodetic } from '../coordinate/Geodetic'; import { ITRF } from '../coordinate/ITRF'; import { J2000 } from '../coordinate/J2000'; import { RIC } from '../coordinate/RIC'; import { Tle } from '../coordinate/Tle'; +import { OptionsParams } from '../interfaces/OptionsParams'; +import { SatelliteParams } from '../interfaces/SatelliteParams'; import { RAE } from '../observation/RAE'; import { Vector3D } from '../operations/Vector3D'; import { Sgp4 } from '../sgp4/sgp4'; @@ -194,9 +194,21 @@ export class Satellite extends BaseObject { */ rae(observer: GroundPosition, date: Date = this.time): RAE { const rae = this.raeOpt(observer, date); + const rae2 = this.raeOpt(observer, new Date(date.getTime() + 1000)); const epoch = new EpochUTC(date.getTime()); - - return new RAE(epoch, rae.rng, (rae.az * DEG2RAD) as Radians, (rae.el * DEG2RAD) as Radians); + const rangeRate = rae2.rng - rae.rng; + const azimuthRate = rae2.az - rae.az; + const elevationRate = rae2.el - rae.el; + + return new RAE( + epoch, + rae.rng, + (rae.az * DEG2RAD) as Radians, + (rae.el * DEG2RAD) as Radians, + rangeRate, + azimuthRate, + elevationRate, + ); } /** @@ -312,6 +324,26 @@ export class Satellite extends BaseObject { return this.raeOpt(observer, date).rng; } + /** + * Applies the Doppler effect to the given frequency based on the observer's position and the date. + * @param freq - The frequency to apply the Doppler effect to. + * @param observer - The observer's position on the ground. + * @param date - The date at which to calculate the Doppler effect. Optional, defaults to the current date. + * @returns The frequency after applying the Doppler effect. + */ + applyDoppler(freq: number, observer: GroundPosition, date?: Date): number { + const doppler = this.dopplerFactor(observer, date); + + return freq * doppler; + } + + /** + * Calculates the Doppler factor for the satellite. + * + * @param observer The observer's ground position. + * @param date The optional date for which to calculate the Doppler factor. If not provided, the current date is used. + * @returns The calculated Doppler factor. + */ dopplerFactor(observer: GroundPosition, date?: Date): number { const position = this.eci(date); diff --git a/src/objects/Sensor.ts b/src/objects/Sensor.ts index 3b0eb06..70597ce 100644 --- a/src/objects/Sensor.ts +++ b/src/objects/Sensor.ts @@ -1,5 +1,5 @@ -import { SensorParams } from 'src/interfaces/SensorParams'; import { PassType } from '../enums/PassType'; +import { SensorParams } from '../interfaces/SensorParams'; import { Degrees, Kilometers, Lookangle, RaeVec3, SpaceObjectType } from '../types/types'; import { GroundPosition } from './GroundPosition'; import { Satellite } from './Satellite'; @@ -51,9 +51,19 @@ export class Sensor extends GroundPosition { super(info); this.validateInputData(info); - Object.keys(info).forEach((key) => { - this[key] = info[key]; - }); + + this.minRng = info.minRng; + this.minAz = info.minAz; + this.minEl = info.minEl; + this.maxRng = info.maxRng; + this.maxAz = info.maxAz; + this.maxEl = info.maxEl; + this.minRng2 = info.minRng2; + this.minAz2 = info.minAz2; + this.minEl2 = info.minEl2; + this.maxRng2 = info.maxRng2; + this.maxAz2 = info.maxAz2; + this.maxEl2 = info.maxEl2; } isSensor(): boolean { @@ -194,10 +204,10 @@ export class Sensor extends GroundPosition { } private validateParameter(value: T, minValue: T, maxValue: T, errorMessage: string): void { - if (minValue !== null && value < minValue) { + if (typeof minValue !== 'undefined' && minValue !== null && (value as number) < (minValue as number)) { throw new Error(errorMessage); } - if (maxValue !== null && value > maxValue) { + if (typeof maxValue !== 'undefined' && maxValue !== null && (value as number) > (maxValue as number)) { throw new Error(errorMessage); } } diff --git a/src/objects/Star.ts b/src/objects/Star.ts index 06e3669..40e9adb 100644 --- a/src/objects/Star.ts +++ b/src/objects/Star.ts @@ -26,7 +26,7 @@ * DEALINGS IN THE SOFTWARE. */ -import { StarObjectParams } from 'src/interfaces/StarObjectParams'; +import { StarObjectParams } from '../interfaces/StarObjectParams'; import { Degrees, EciVec3, @@ -50,7 +50,7 @@ export class Star extends BaseObject { bf: string; h: string; pname: string; - vmag: number; + vmag?: number; constructor(info: StarObjectParams) { super(info); @@ -59,17 +59,10 @@ export class Star extends BaseObject { this.ra = info.ra; this.dec = info.dec; - if (info.pname) { - this.pname = info.pname; - } - - if (info.bf) { - this.bf = info.bf; - } - - if (info.h) { - this.h = info.h; - } + this.pname = info.pname ?? ''; + this.bf = info.bf ?? ''; + this.h = info.h ?? ''; + this.vmag = info.vmag; } getEci(lla: LlaVec3 = { lat: 180, lon: 0, alt: 0 }, date: Date = this.time): EciVec3 { diff --git a/src/observation/RAE.ts b/src/observation/RAE.ts index e661eb2..6424b8d 100644 --- a/src/observation/RAE.ts +++ b/src/observation/RAE.ts @@ -42,8 +42,8 @@ export class RAE { azimuthRateDegrees?: number, elevationRateDegrees?: number, ): RAE { - const azimuthRate = azimuthRateDegrees !== null ? azimuthRateDegrees * DEG2RAD : undefined; - const elevationRate = elevationRateDegrees !== null ? elevationRateDegrees * DEG2RAD : undefined; + const azimuthRate = azimuthRateDegrees ? azimuthRateDegrees * DEG2RAD : undefined; + const elevationRate = elevationRateDegrees ? elevationRateDegrees * DEG2RAD : undefined; return new RAE( epoch, @@ -111,12 +111,12 @@ export class RAE { // / Azimuth rate _(°/s)_. get azimuthRateDegrees(): number | undefined { - return this.azimuthRate !== null ? this.azimuthRate * RAD2DEG : undefined; + return this.azimuthRate ? this.azimuthRate * RAD2DEG : undefined; } // / Elevation rate _(°/s)_. get elevationRateDegrees(): number | undefined { - return this.elevationRate !== null ? this.elevationRate * RAD2DEG : undefined; + return this.elevationRate ? this.elevationRate * RAD2DEG : undefined; } toString(): string { @@ -161,7 +161,7 @@ export class RAE { * [azimuthRate] are not defined. */ toStateVector(site: J2000): J2000 { - if (this.rangeRate === null || this.elevationRate === null || this.azimuthRate === null) { + if (!this.rangeRate || !this.elevationRate || !this.azimuthRate) { throw new Error('Cannot create state, required values are undefined.'); } const ecef = site.toITRF(); diff --git a/src/observation/RadecGeocentric.ts b/src/observation/RadecGeocentric.ts index c2194c7..de1fb3e 100644 --- a/src/observation/RadecGeocentric.ts +++ b/src/observation/RadecGeocentric.ts @@ -35,8 +35,8 @@ export class RadecGeocentric { declinationRateDegrees?: number, rangeRate?: number, ): RadecGeocentric { - const rightAscensionRate = !rightAscensionRateDegrees && rightAscensionRateDegrees * DEG2RAD; - const declinationRate = !declinationRateDegrees && declinationRateDegrees * DEG2RAD; + const rightAscensionRate = rightAscensionRateDegrees && rightAscensionRateDegrees * DEG2RAD; + const declinationRate = declinationRateDegrees && declinationRateDegrees * DEG2RAD; return new RadecGeocentric( epoch, @@ -94,12 +94,12 @@ export class RadecGeocentric { // / Right-ascension rate _(°/s)_. get rightAscensionRateDegrees(): number | undefined { - return this.rightAscensionRate !== null ? this.rightAscensionRate * RAD2DEG : undefined; + return this.rightAscensionRate ? this.rightAscensionRate * RAD2DEG : undefined; } // / Declination rate _(°/s)_. get declinationRateDegrees(): number | undefined { - return this.declinationRate !== null ? this.declinationRate * RAD2DEG : undefined; + return this.declinationRate ? this.declinationRate * RAD2DEG : undefined; } /** @@ -121,7 +121,7 @@ export class RadecGeocentric { * to override the value contained in this observation. */ velocity(range?: number, rangeRate?: number): Vector3D { - if (this.rightAscensionRate === null || this.declinationRate === null) { + if (!this.rightAscensionRate || !this.declinationRate) { throw new Error('Velocity unsolvable, missing ra/dec rates.'); } const r = range ?? this.range ?? 1.0; diff --git a/src/observation/RadecTopocentric.ts b/src/observation/RadecTopocentric.ts index 8306057..5205909 100644 --- a/src/observation/RadecTopocentric.ts +++ b/src/observation/RadecTopocentric.ts @@ -35,8 +35,8 @@ export class RadecTopocentric { declinationRateDegrees?: number, rangeRate?: number, ): RadecTopocentric { - const rightAscensionRate = rightAscensionRateDegrees !== null ? rightAscensionRateDegrees * DEG2RAD : undefined; - const declinationRate = declinationRateDegrees !== null ? declinationRateDegrees * DEG2RAD : undefined; + const rightAscensionRate = rightAscensionRateDegrees ? rightAscensionRateDegrees * DEG2RAD : undefined; + const declinationRate = declinationRateDegrees ? declinationRateDegrees * DEG2RAD : undefined; return new RadecTopocentric( epoch, @@ -99,12 +99,12 @@ export class RadecTopocentric { // / Right-ascension rate _(°/s)_. get rightAscensionRateDegrees(): number | undefined { - return this.rightAscensionRate !== null ? this.rightAscensionRate * RAD2DEG : undefined; + return this.rightAscensionRate ? this.rightAscensionRate * RAD2DEG : undefined; } // / Declination rate _(°/s)_. get declinationRateDegrees(): number | undefined { - return this.declinationRate !== null ? this.declinationRate * RAD2DEG : undefined; + return this.declinationRate ? this.declinationRate * RAD2DEG : undefined; } /** @@ -126,7 +126,7 @@ export class RadecTopocentric { * to override the values contained in this observation. */ velocity(site: J2000, range?: number, rangeRate?: number): Vector3D { - if (this.rightAscensionRate === null || this.declinationRate === null) { + if (!this.rightAscensionRate || !this.declinationRate) { throw new Error('Velocity unsolvable, missing ra/dec rates.'); } const r = range ?? this.range ?? 1.0; diff --git a/src/operations/Matrix.ts b/src/operations/Matrix.ts index 8f3d4af..dabb99f 100644 --- a/src/operations/Matrix.ts +++ b/src/operations/Matrix.ts @@ -2,12 +2,12 @@ import { Vector } from './Vector'; import { Vector3D } from './Vector3D'; export class Matrix { - private _elements: number[][]; + public elements: number[][]; public readonly rows: number; public readonly columns: number; constructor(elements: number[][]) { - this._elements = elements; + this.elements = elements; this.rows = elements.length; this.columns = elements[0].length; } @@ -34,11 +34,11 @@ export class Matrix { const sinT = Math.sin(theta); const result = Matrix.zero(3, 3); - result._elements[0][0] = 1.0; - result._elements[1][1] = cosT; - result._elements[1][2] = sinT; - result._elements[2][1] = -sinT; - result._elements[2][2] = cosT; + result.elements[0][0] = 1.0; + result.elements[1][1] = cosT; + result.elements[1][2] = sinT; + result.elements[2][1] = -sinT; + result.elements[2][2] = cosT; return result; } @@ -48,11 +48,11 @@ export class Matrix { const sinT = Math.sin(theta); const result = Matrix.zero(3, 3); - result._elements[0][0] = cosT; - result._elements[0][2] = -sinT; - result._elements[1][1] = 1.0; - result._elements[2][0] = sinT; - result._elements[2][2] = cosT; + result.elements[0][0] = cosT; + result.elements[0][2] = -sinT; + result.elements[1][1] = 1.0; + result.elements[2][0] = sinT; + result.elements[2][2] = cosT; return result; } @@ -62,11 +62,11 @@ export class Matrix { const sinT = Math.sin(theta); const result = Matrix.zero(3, 3); - result._elements[0][0] = cosT; - result._elements[0][1] = sinT; - result._elements[1][0] = -sinT; - result._elements[1][1] = cosT; - result._elements[2][2] = 1.0; + result.elements[0][0] = cosT; + result.elements[0][1] = sinT; + result.elements[1][0] = -sinT; + result.elements[1][1] = cosT; + result.elements[2][2] = 1.0; return result; } @@ -116,7 +116,7 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < this.columns; j++) { - result._elements[i][j] = this._elements[i][j] + m._elements[i][j]; + result.elements[i][j] = this.elements[i][j] + m.elements[i][j]; } } @@ -128,7 +128,7 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < this.columns; j++) { - result._elements[i][j] = this._elements[i][j] - m._elements[i][j]; + result.elements[i][j] = this.elements[i][j] - m.elements[i][j]; } } @@ -140,7 +140,7 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < this.columns; j++) { - result._elements[i][j] = this._elements[i][j] * n; + result.elements[i][j] = this.elements[i][j] * n; } } @@ -157,7 +157,7 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < m.columns; j++) { for (let k = 0; k < this.columns; k++) { - result._elements[i][j] += this._elements[i][k] * m._elements[k][j]; + result.elements[i][j] += this.elements[i][k] * m.elements[k][j]; } } } @@ -170,7 +170,7 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < this.columns; j++) { - result._elements[i][j] = this._elements[i][j] * m._elements[i][j]; + result.elements[i][j] = this.elements[i][j] * m.elements[i][j]; } } @@ -184,7 +184,7 @@ export class Matrix { let total = 0.0; for (let j = 0; j < this.columns; j++) { - total += this._elements[i][j] * v[j]; + total += this.elements[i][j] * v.elements[j]; } result[i] = total; } @@ -199,7 +199,19 @@ export class Matrix { let total = 0.0; for (let j = 0; j < this.columns; j++) { - total += this._elements[i][j] * v[j]; + switch (j) { + case 0: + total += this.elements[i][j] * v.x; + break; + case 1: + total += this.elements[i][j] * v.y; + break; + case 2: + total += this.elements[i][j] * v.z; + break; + default: + break; + } } result[i] = total; } @@ -212,8 +224,8 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < this.columns; j++) { - if (this._elements[i][j] !== 0) { - output._elements[i][j] = 1 / this._elements[i][j]; + if (this.elements[i][j] !== 0) { + output.elements[i][j] = 1 / this.elements[i][j]; } } } @@ -226,7 +238,7 @@ export class Matrix { for (let i = 0; i < this.rows; i++) { for (let j = 0; j < this.columns; j++) { - result._elements[j][i] = this._elements[i][j]; + result.elements[j][i] = this.elements[i][j]; } } @@ -241,12 +253,12 @@ export class Matrix { let total = 0.0; for (let j = 0; j < k; j++) { - total += result._elements[i][j] * result._elements[k][j]; + total += result.elements[i][j] * result.elements[k][j]; } - result._elements[i][k] = + result.elements[i][k] = i === k - ? Math.sqrt(this._elements[i][i] - total) - : (1 / result._elements[k][k]) * (this._elements[i][k] - total); + ? Math.sqrt(this.elements[i][i] - total) + : (1 / result.elements[k][k]) * (this.elements[i][k] - total); } } @@ -257,17 +269,17 @@ export class Matrix { if (i === j) { return; } - const tmp = this._elements[i]; + const tmp = this.elements[i]; - this._elements[i] = this._elements[j]; - this._elements[j] = tmp; + this.elements[i] = this.elements[j]; + this.elements[j] = tmp; } private _toReducedRowEchelonForm(): void { for (let lead = 0, row = 0; row < this.rows && lead < this.columns; ++row, ++lead) { let i = row; - while (this._elements[i][lead] === 0) { + while (this.elements[i][lead] === 0) { if (++i === this.rows) { i = row; if (++lead === this.columns) { @@ -276,21 +288,21 @@ export class Matrix { } } this._swapRows(i, row); - if (this._elements[row][lead] !== 0) { - const f = this._elements[row][lead]; + if (this.elements[row][lead] !== 0) { + const f = this.elements[row][lead]; for (let column = 0; column < this.columns; ++column) { - this._elements[row][column] /= f; + this.elements[row][column] /= f; } } for (let j = 0; j < this.rows; ++j) { if (j === row) { continue; } - const f = this._elements[j][lead]; + const f = this.elements[j][lead]; for (let column = 0; column < this.columns; ++column) { - this._elements[j][column] -= f * this._elements[row][column]; + this.elements[j][column] -= f * this.elements[row][column]; } } } @@ -301,16 +313,16 @@ export class Matrix { for (let row = 0; row < this.rows; ++row) { for (let column = 0; column < this.columns; ++column) { - tmp._elements[row][column] = this._elements[row][column]; + tmp.elements[row][column] = this.elements[row][column]; } - tmp._elements[row][row + this.columns] = 1.0; + tmp.elements[row][row + this.columns] = 1.0; } tmp._toReducedRowEchelonForm(); const inv = Matrix.zero(this.rows, this.columns); for (let row = 0; row < this.rows; ++row) { for (let column = 0; column < this.columns; ++column) { - inv._elements[row][column] = tmp._elements[row][column + this.columns]; + inv.elements[row][column] = tmp.elements[row][column + this.columns]; } } diff --git a/src/operations/Vector.ts b/src/operations/Vector.ts index ab4993c..f11e9dd 100644 --- a/src/operations/Vector.ts +++ b/src/operations/Vector.ts @@ -4,8 +4,8 @@ import { Vector3D } from './Vector3D'; // / Vector operations. export class Vector { // / Create a new [Vector] object from an array of [_elements]. - constructor(private _elements: T[] | Float64Array) { - this.length = _elements.length; + constructor(public elements: T[] | Float64Array) { + this.length = elements.length; } // / Create a zero-filled [Vector] of the provided [length]; @@ -57,43 +57,43 @@ export class Vector { toString(fixed = -1): string { if (fixed < 0) { - return `[${this._elements.join(', ')}]`; + return `[${this.elements.join(', ')}]`; } - const output = this._elements.map((e) => e.toFixed(fixed)); + const output = (this.elements as number[]).map((e) => e.toFixed(fixed)); return `[${output.join(', ')}]`; } // / X-axis component. get x(): number { - return this._elements[0]; + return this.elements[0]; } // / Y-axis component. get y(): number { - return this._elements[1]; + return this.elements[1]; } // / Z-axis component. get z(): number { - return this._elements[2]; + return this.elements[2]; } // / Convert the elements of this [Vector] to a list object. toList(): number[] { - return Array.from(this._elements); + return Array.from(this.elements); } // / Copy the elements of this [Vector] to a new array. toArray(): Float64Array { - return new Float64Array(this._elements); + return new Float64Array(this.elements); } // / Return the magnitude of this vector. magnitude(): number { let total = 0; - for (const x of this._elements) { + for (const x of this.elements) { total += x * x; } @@ -105,7 +105,7 @@ export class Vector { const output = new Array(this.length); for (let i = 0; i < this.length; i++) { - output[i] = this._elements[i] + v._elements[i]; + output[i] = this.elements[i] + v.elements[i]; } return new Vector(output); @@ -116,7 +116,7 @@ export class Vector { const output = new Array(this.length); for (let i = 0; i < this.length; i++) { - output[i] = this._elements[i] - v._elements[i]; + output[i] = this.elements[i] - v.elements[i]; } return new Vector(output); @@ -127,7 +127,7 @@ export class Vector { const output = new Array(this.length); for (let i = 0; i < this.length; i++) { - output[i] = this._elements[i] * n; + output[i] = this.elements[i] * n; } return new Vector(output); @@ -159,7 +159,7 @@ export class Vector { let total = 0; for (let i = 0; i < this.length; i++) { - total += this._elements[i] * v._elements[i]; + total += this.elements[i] * v.elements[i]; } return total; @@ -172,7 +172,7 @@ export class Vector { for (let i = 0; i < this.length; i++) { result[i] = []; for (let j = 0; j < v.length; j++) { - result[i][j] = this._elements[i] * v._elements[j]; + result[i][j] = this.elements[i] * v.elements[j]; } } @@ -185,8 +185,8 @@ export class Vector { for (let i = 0; i < this.length; i++) { output[i] = - this._elements[(i + 1) % this.length] * v._elements[(i + 2) % this.length] - - this._elements[(i + 2) % this.length] * v._elements[(i + 1) % this.length]; + this.elements[(i + 1) % this.length] * v.elements[(i + 2) % this.length] - + this.elements[(i + 2) % this.length] * v.elements[(i + 1) % this.length]; } return new Vector(output); @@ -203,9 +203,9 @@ export class Vector { } return new Matrix([ - [0, -this._elements[2], this._elements[1]], - [this._elements[2], 0, -this._elements[0]], - [-this._elements[1], this._elements[0], 0], + [0, -this.elements[2], this.elements[1]], + [this.elements[2], 0, -this.elements[0]], + [-this.elements[1], this.elements[0], 0], ]); } @@ -218,9 +218,9 @@ export class Vector { const sinT = Math.sin(theta); const output = new Array(3); - output[0] = this._elements[0]; - output[1] = cosT * this._elements[1] + sinT * this._elements[2]; - output[2] = -sinT * this._elements[1] + cosT * this._elements[2]; + output[0] = this.elements[0]; + output[1] = cosT * this.elements[1] + sinT * this.elements[2]; + output[2] = -sinT * this.elements[1] + cosT * this.elements[2]; return new Vector(output); } @@ -234,9 +234,9 @@ export class Vector { const sinT = Math.sin(theta); const output = new Array(3); - output[0] = cosT * this._elements[0] + -sinT * this._elements[2]; - output[1] = this._elements[1]; - output[2] = sinT * this._elements[0] + cosT * this._elements[2]; + output[0] = cosT * this.elements[0] + -sinT * this.elements[2]; + output[1] = this.elements[1]; + output[2] = sinT * this.elements[0] + cosT * this.elements[2]; return new Vector(output); } @@ -250,9 +250,9 @@ export class Vector { const sinT = Math.sin(theta); const output = new Array(3); - output[0] = cosT * this._elements[0] + sinT * this._elements[1]; - output[1] = -sinT * this._elements[0] + cosT * this._elements[1]; - output[2] = this._elements[2]; + output[0] = cosT * this.elements[0] + sinT * this.elements[1]; + output[1] = -sinT * this.elements[0] + cosT * this.elements[1]; + output[2] = this.elements[2]; return new Vector(output); } @@ -319,7 +319,7 @@ export class Vector { * @returns A new Vector containing the sliced elements. */ slice(start: number, end: number): Vector { - return new Vector(this._elements.slice(start, end)); + return new Vector(this.elements.slice(start, end)); } // / Convert this [Vector] into a row [Matrix]. @@ -338,6 +338,6 @@ export class Vector { * @returns A new Vector3D object containing the converted elements. */ toVector3D(index: number): Vector3D { - return new Vector3D(this._elements[index], this._elements[index + 1], this._elements[index + 2]); + return new Vector3D(this.elements[index], this.elements[index + 1], this.elements[index + 2]); } } diff --git a/src/operations/Vector3D.ts b/src/operations/Vector3D.ts index 87f560b..0078de1 100644 --- a/src/operations/Vector3D.ts +++ b/src/operations/Vector3D.ts @@ -13,7 +13,7 @@ export class Vector3D { * [Vector] object. */ static fromVector(v: Vector): Vector3D { - return new Vector3D(v[0], v[1], v[2]); + return new Vector3D(v.x, v.y, v.z); } // / Origin vector. diff --git a/src/sgp4/sgp4.ts b/src/sgp4/sgp4.ts index 5d148c5..82d9c06 100644 --- a/src/sgp4/sgp4.ts +++ b/src/sgp4/sgp4.ts @@ -52,6 +52,81 @@ export enum Sgp4GravConstants { wgs84 = 'wgs84', } +interface DsInitParams { + xke: number; + cosim: number; + argpo: number; + s1: number; + s2: number; + s3: number; + s4: number; + s5: number; + sinim: number; + ss1: number; + ss2: number; + ss3: number; + ss4: number; + ss5: number; + sz1: number; + sz3: number; + sz11: number; + sz13: number; + sz21: number; + sz23: number; + sz31: number; + sz33: number; + t: number; + tc: number; + gsto: number; + mo: number; + mdot: number; + no: number; + nodeo: number; + nodedot: number; + xPIdot: number; + z1: number; + z3: number; + z11: number; + z13: number; + z21: number; + z23: number; + z31: number; + z33: number; + ecco: number; + eccsq: number; + emsq: number; + em: number; + argpm: number; + inclm: number; + mm: number; + nm: number; + nodem: number; + irez: number; + atime: number; + d2201: number; + d2211: number; + d3210: number; + d3222: number; + d4410: number; + d4422: number; + d5220: number; + d5232: number; + d5421: number; + d5433: number; + dedt: number; + didt: number; + dmdt: number; + dnodt: number; + domdt: number; + del1: number; + del2: number; + del3: number; + xfact: number; + xlamo: number; + xli: number; + xni: number; +} + /* * ---------------------------------------------------------------- * @@ -243,9 +318,9 @@ export class Sgp4 { alta: null, altp: null, argpdot: null, - argpo: null, + argpo: null as number | null, aycof: null, - bstar: null, + bstar: null as number | null, cc1: null, cc4: null, cc5: null, @@ -259,28 +334,28 @@ export class Sgp4 { dedt: null, delmo: null, del1: null, - ecco: null, + ecco: null as number | null, em: null, - epochdays: null, - epochyr: null, + epochdays: null as number | null, + epochyr: null as number | null, error: null as number | null, eta: null, gsto: null, im: null, - inclo: null, + inclo: null as number | null, init: null, isimp: null, - jdsatepoch: null, + jdsatepoch: null as number | null, mdot: null, method: null, - mo: null, + mo: null as number | null, mm: null, - nddot: null, - ndot: null, - no: null, + nddot: null as number | null, + ndot: null as number | null, + no: null as number | null, nodecf: null, nodedot: null, - nodeo: null, + nodeo: null as number | null, om: null, Om: null, omgcof: null, @@ -441,7 +516,7 @@ export class Sgp4 { satrec.jdsatepoch = jdayRes.jd + jdayRes.jdFrac; // ---------------- initialize the orbit at sgp4epoch ------------------- - Sgp4.sgp4init_(satrec, { + Sgp4.sgp4init_(satrec as unknown as SatelliteRecord, { whichconst, opsmode, satn: satrec.satnum, @@ -457,7 +532,7 @@ export class Sgp4 { xnodeo: satrec.nodeo, }); - return satrec; + return satrec as unknown as SatelliteRecord; } // Mag @@ -1252,7 +1327,8 @@ export class Sgp4 { * Sgp4fix for kepler iteration * the following iteration needs better limits on corrections */ - let coseo1, sineo1; + let coseo1 = 0; + let sineo1 = 0; while (Math.abs(tem5) >= 1.0e-12 && ktr <= 10) { sineo1 = Math.sin(eo1); @@ -1447,7 +1523,7 @@ export class Sgp4 { let omega: number; let argp: number; let nu: number; - let m: number; + let m = 0; let arglat: number; let truelon: number; let lonper: number; @@ -2018,32 +2094,32 @@ export class Sgp4 { sl2: number; sl3: number; sl4: number; - s1: number; - s2: number; - s3: number; - s4: number; - s5: number; - s6: number; - s7: number; - ss1: number; - ss2: number; - ss3: number; - ss4: number; - ss5: number; - ss6: number; - ss7: number; - sz1: number; - sz2: number; - sz3: number; - sz11: number; - sz12: number; - sz13: number; - sz21: number; - sz22: number; - sz23: number; - sz31: number; - sz32: number; - sz33: number; + s1?: number; + s2?: number; + s3?: number; + s4?: number; + s5?: number; + s6?: number; + s7?: number; + ss1?: number; + ss2?: number; + ss3?: number; + ss4?: number; + ss5?: number; + ss6?: number; + ss7?: number; + sz1?: number; + sz2?: number; + sz3?: number; + sz11?: number; + sz12?: number; + sz13?: number; + sz21?: number; + sz22?: number; + sz23?: number; + sz31?: number; + sz32?: number; + sz33?: number; xgh2: number; xgh3: number; xgh4: number; @@ -2055,18 +2131,18 @@ export class Sgp4 { xl3: number; xl4: number; nm: number; - z1: number; - z2: number; - z3: number; - z11: number; - z12: number; - z13: number; - z21: number; - z22: number; - z23: number; - z31: number; - z32: number; - z33: number; + z1?: number; + z2?: number; + z3?: number; + z11?: number; + z12?: number; + z13?: number; + z21?: number; + z22?: number; + z23?: number; + z31?: number; + z32?: number; + z33?: number; zmol: number; zmos: number; } { @@ -2085,44 +2161,44 @@ export class Sgp4 { const TAU = 2.0 * Math.PI; // --------------------- local variables ------------------------ - let s1, - s2, - s3, - s4, - s5, - s6, - s7, - ss1, - ss2, - ss3, - ss4, - ss5, - ss6, - ss7, - sz1, - sz11, - sz12, - sz13, - sz2, - sz21, - sz22, - sz23, - sz3, - sz31, - sz32, - sz33, - z1, - z11, - z12, - z13, - z2, - z21, - z22, - z23, - z3, - z31, - z32, - z33; + let s1 = 0, + s2 = 0, + s3 = 0, + s4 = 0, + s5 = 0, + s6 = 0, + s7 = 0, + ss1 = 0, + ss2 = 0, + ss3 = 0, + ss4 = 0, + ss5 = 0, + ss6 = 0, + ss7 = 0, + sz1 = 0, + sz11 = 0, + sz12 = 0, + sz13 = 0, + sz2 = 0, + sz21 = 0, + sz22 = 0, + sz23 = 0, + sz3 = 0, + sz31 = 0, + sz32 = 0, + sz33 = 0, + z1 = 0, + z11 = 0, + z12 = 0, + z13 = 0, + z2 = 0, + z21 = 0, + z22 = 0, + z23 = 0, + z3 = 0, + z31 = 0, + z32 = 0, + z33 = 0; const nm = np; const em = ep; const snodm = Math.sin(nodep); @@ -2447,80 +2523,7 @@ export class Sgp4 { * vallado, crawford, hujsak, kelso 2006 *---------------------------------------------------------------------------- */ - private static dsinit_(options: { - xke: number; - cosim: number; - argpo: number; - s1: number; - s2: number; - s3: number; - s4: number; - s5: number; - sinim: number; - ss1: number; - ss2: number; - ss3: number; - ss4: number; - ss5: number; - sz1: number; - sz3: number; - sz11: number; - sz13: number; - sz21: number; - sz23: number; - sz31: number; - sz33: number; - t: number; - tc: number; - gsto: number; - mo: number; - mdot: number; - no: number; - nodeo: number; - nodedot: number; - xPIdot: number; - z1: number; - z3: number; - z11: number; - z13: number; - z21: number; - z23: number; - z31: number; - z33: number; - ecco: number; - eccsq: number; - emsq: number; - em: number; - argpm: number; - inclm: number; - mm: number; - nm: number; - nodem: number; - irez: number; - atime: number; - d2201: number; - d2211: number; - d3210: number; - d3222: number; - d4410: number; - d4422: number; - d5220: number; - d5232: number; - d5421: number; - d5433: number; - dedt: number; - didt: number; - dmdt: number; - dnodt: number; - domdt: number; - del1: number; - del2: number; - del3: number; - xfact: number; - xlamo: number; - xli: number; - xni: number; - }): { + private static dsinit_(options: DsInitParams): { em: number; argpm: number; inclm: number; @@ -3053,7 +3056,13 @@ export class Sgp4 { delt = stepn; } - let ft, x2li, x2omi, xldot, xnddt, xndt, xomi; + let ft = 0; + let x2li = 0; + let x2omi = 0; + let xldot = 0; + let xnddt = 0; + let xndt = 0; + let xomi = 0; let iretn = 381; // Added for do loop while (iretn === 381) { @@ -3500,7 +3509,7 @@ export class Sgp4 { */ private static sgp4init_( satrec: SatelliteRecord, - options?: { + options: { whichconst?: Sgp4GravConstants; opsmode?: Sgp4OpsMode; satn?: string; @@ -4046,7 +4055,7 @@ export class Sgp4 { xni: satrec.xni, }; - const dsinitResult = Sgp4.dsinit_(dsinitOptions); + const dsinitResult = Sgp4.dsinit_(dsinitOptions as DsInitParams); satrec.irez = dsinitResult.irez; satrec.atime = dsinitResult.atime; diff --git a/src/transforms/transforms.ts b/src/transforms/transforms.ts index 87d9b20..ab26de9 100644 --- a/src/transforms/transforms.ts +++ b/src/transforms/transforms.ts @@ -155,7 +155,7 @@ export function eci2lla(eci: EciVec3, gmst: number): LlaVec3(lla: LlaVec3, ecf: EcfVec3 } export const jday = (year?: number, mon?: number, day?: number, hr?: number, minute?: number, sec?: number) => { - if (!year) { + if (typeof year === 'undefined') { const now = new Date(); const jDayStart = new Date(now.getUTCFullYear(), 0, 0); const jDayDiff = now.getDate() - jDayStart.getDate(); @@ -494,6 +494,16 @@ export const jday = (year?: number, mon?: number, day?: number, hr?: number, min return Math.floor(jDayDiff / MILLISECONDS_TO_DAYS); } + if ( + typeof mon === 'undefined' || + typeof day === 'undefined' || + typeof hr === 'undefined' || + typeof minute === 'undefined' || + typeof sec === 'undefined' + ) { + throw new Error('Invalid date'); + } + return ( 367.0 * year - Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) + diff --git a/src/types/types.ts b/src/types/types.ts index 1fc7655..d598841 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -607,7 +607,7 @@ export type AzEl = { export type RaDec = { dec: Radians; ra: Radians; - dist?: Kilometers; + dist: Kilometers; }; export interface RadarSensor extends Sensor { @@ -629,7 +629,7 @@ export interface RadarSensor extends Sensor { export type SunTime = { solarNoon: Date; nadir: Date; -}; +} & { [key: string]: Date }; export type LaunchDetails = { launchDate?: string; diff --git a/src/utils/functions.ts b/src/utils/functions.ts index 1dc7116..cbda9a0 100644 --- a/src/utils/functions.ts +++ b/src/utils/functions.ts @@ -550,7 +550,7 @@ export function jacobian(f: JacobianFunction, m: number, x0: Float64Array, step const cd = fp.subtract(fm).scale(1.0 / step); for (let i = 0; i < m; i++) { - j[i][k] = cd[i]; + j[i][k] = cd.elements[i]; } } @@ -655,6 +655,8 @@ const spaceObjTypeStrMap_ = { [SpaceObjectType.ENGINE_MANUFACTURER]: 'Engine Manufacturer', [SpaceObjectType.NOTIONAL]: 'Notional', [SpaceObjectType.FRAGMENT]: 'Fragment', + [SpaceObjectType.SHORT_TERM_FENCE]: 'Short Term Fence', + [SpaceObjectType.MAX_SPACE_OBJECT_TYPE]: 'Max Space Object Type', }; /** diff --git a/test/objects/star.test.ts b/test/objects/star.test.ts index 985a83f..da64210 100644 --- a/test/objects/star.test.ts +++ b/test/objects/star.test.ts @@ -4,8 +4,8 @@ * @since 3.0.0 */ +import { Degrees, Kilometers, Radians } from '../../lib/index'; import { Star } from '../../lib/objects'; -import { Degrees, Kilometers, Radians } from '../../lib/ootk-core'; describe('Basic Star functionality', () => { const star = new Star({ diff --git a/test/sat/sat.test.ts b/test/sat/sat.test.ts index 161ee6e..1e86185 100644 --- a/test/sat/sat.test.ts +++ b/test/sat/sat.test.ts @@ -4,7 +4,7 @@ * @since 1.2.0 */ -import { Satellite, TleLine1, TleLine2 } from '../../lib/ootk-core'; +import { Satellite, TleLine1, TleLine2 } from '../../lib/index'; import { RAD2DEG } from '../../lib/utils/constants'; const dateObj = new Date(1661400000000); diff --git a/test/sat/sensor.test.ts b/test/sat/sensor.test.ts index fbb8d11..de2345a 100644 --- a/test/sat/sensor.test.ts +++ b/test/sat/sensor.test.ts @@ -4,7 +4,7 @@ * @since 1.2.0 */ -import { Degrees, Kilometers, Satellite, Sensor, SpaceObjectType, TleLine1, TleLine2 } from '../../lib/ootk-core'; +import { Degrees, Kilometers, Satellite, Sensor, SpaceObjectType, TleLine1, TleLine2 } from '../../lib/index'; const dateObj = new Date(1661400000000); diff --git a/test/sgp4/full-catalog/sgp4-catalog-0.test.js b/test/sgp4/full-catalog/sgp4-catalog-0.test.js index dc285ed..2c44534 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-0.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-0.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_0'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-1.test.js b/test/sgp4/full-catalog/sgp4-catalog-1.test.js index 3abc77b..6331453 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-1.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-1.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_1'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-10.test.js b/test/sgp4/full-catalog/sgp4-catalog-10.test.js index 544b392..5c2f778 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-10.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-10.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_10'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-11.test.js b/test/sgp4/full-catalog/sgp4-catalog-11.test.js index ea48998..fe55617 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-11.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-11.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_11'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-12.test.js b/test/sgp4/full-catalog/sgp4-catalog-12.test.js index c6e71b7..183a41c 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-12.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-12.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_12'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-13.test.js b/test/sgp4/full-catalog/sgp4-catalog-13.test.js index 6f189a3..310d47f 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-13.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-13.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_13'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-14.test.js b/test/sgp4/full-catalog/sgp4-catalog-14.test.js index 79f341d..e42b5a7 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-14.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-14.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_14'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-15.test.js b/test/sgp4/full-catalog/sgp4-catalog-15.test.js index 5140d71..e8bb8d6 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-15.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-15.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_15'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-16.test.js b/test/sgp4/full-catalog/sgp4-catalog-16.test.js index 3235f04..f1e1854 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-16.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-16.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_16'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-17.test.js b/test/sgp4/full-catalog/sgp4-catalog-17.test.js index bbffe20..67b5e23 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-17.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-17.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_17'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-18.test.js b/test/sgp4/full-catalog/sgp4-catalog-18.test.js index 1c8a7e4..9c6fcbf 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-18.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-18.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_18'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-19.test.js b/test/sgp4/full-catalog/sgp4-catalog-19.test.js index 29dd836..ce2604d 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-19.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-19.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_19'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-2.test.js b/test/sgp4/full-catalog/sgp4-catalog-2.test.js index cfec37e..687d2f6 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-2.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-2.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_2'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-20.test.js b/test/sgp4/full-catalog/sgp4-catalog-20.test.js index 17fedf9..f3af192 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-20.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-20.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_20'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-21.test.js b/test/sgp4/full-catalog/sgp4-catalog-21.test.js index 4f4f89a..17c32a8 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-21.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-21.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_21'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-22.test.js b/test/sgp4/full-catalog/sgp4-catalog-22.test.js index e7d9280..3566fc9 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-22.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-22.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_22'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-23.test.js b/test/sgp4/full-catalog/sgp4-catalog-23.test.js index 4499857..85fbe5c 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-23.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-23.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_23'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-24.test.js b/test/sgp4/full-catalog/sgp4-catalog-24.test.js index 400443f..0fe3d6d 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-24.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-24.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_24'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-25.test.js b/test/sgp4/full-catalog/sgp4-catalog-25.test.js index 72bf0ea..f01b25b 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-25.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-25.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_25'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-26.test.js b/test/sgp4/full-catalog/sgp4-catalog-26.test.js index 4b0d22e..a78c782 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-26.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-26.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_26'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-27.test.js b/test/sgp4/full-catalog/sgp4-catalog-27.test.js index 7ae9534..c0d29c8 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-27.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-27.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_27'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-28.test.js b/test/sgp4/full-catalog/sgp4-catalog-28.test.js index 1769119..64c66b2 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-28.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-28.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_28'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-29.test.js b/test/sgp4/full-catalog/sgp4-catalog-29.test.js index 24caed4..8c856c8 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-29.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-29.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_29'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-3.test.js b/test/sgp4/full-catalog/sgp4-catalog-3.test.js index a1de1dd..faf87ee 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-3.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-3.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_3'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-30.test.js b/test/sgp4/full-catalog/sgp4-catalog-30.test.js index 13ce09a..1d63d9f 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-30.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-30.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_30'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-31.test.js b/test/sgp4/full-catalog/sgp4-catalog-31.test.js index c59cd5c..fbbf904 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-31.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-31.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_31'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-32.test.js b/test/sgp4/full-catalog/sgp4-catalog-32.test.js index c7be869..868338d 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-32.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-32.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_32'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-33.test.js b/test/sgp4/full-catalog/sgp4-catalog-33.test.js index cad5c89..a88e000 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-33.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-33.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_33'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-34.test.js b/test/sgp4/full-catalog/sgp4-catalog-34.test.js index 6313a9c..320693e 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-34.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-34.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_34'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-35.test.js b/test/sgp4/full-catalog/sgp4-catalog-35.test.js index dae0d0e..85730ab 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-35.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-35.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_35'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-36.test.js b/test/sgp4/full-catalog/sgp4-catalog-36.test.js index ed6ae00..797aca8 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-36.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-36.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_36'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-37.test.js b/test/sgp4/full-catalog/sgp4-catalog-37.test.js index 7fe7a2d..138a5a8 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-37.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-37.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_37'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-38.test.js b/test/sgp4/full-catalog/sgp4-catalog-38.test.js index 605fe5b..5da829b 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-38.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-38.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_38'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-39.test.js b/test/sgp4/full-catalog/sgp4-catalog-39.test.js index 9876048..0be305e 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-39.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-39.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_39'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-4.test.js b/test/sgp4/full-catalog/sgp4-catalog-4.test.js index 7d0bb95..28bbcc8 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-4.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-4.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_4'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-40.test.js b/test/sgp4/full-catalog/sgp4-catalog-40.test.js index dedb0ae..a7d7a2f 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-40.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-40.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_40'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-41.test.js b/test/sgp4/full-catalog/sgp4-catalog-41.test.js index 37f1e27..37d51ad 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-41.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-41.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_41'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-42.test.js b/test/sgp4/full-catalog/sgp4-catalog-42.test.js index 4ad55cb..7f002de 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-42.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-42.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_42'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-43.test.js b/test/sgp4/full-catalog/sgp4-catalog-43.test.js index 3c3288e..4034e0c 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-43.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-43.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_43'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-44.test.js b/test/sgp4/full-catalog/sgp4-catalog-44.test.js index 8bf524e..78bafe2 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-44.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-44.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_44'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-45.test.js b/test/sgp4/full-catalog/sgp4-catalog-45.test.js index 85c6ad9..1f73812 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-45.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-45.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_45'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-46.test.js b/test/sgp4/full-catalog/sgp4-catalog-46.test.js index 5c3b86a..9cba00f 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-46.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-46.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_46'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-47.test.js b/test/sgp4/full-catalog/sgp4-catalog-47.test.js index 2344705..5313735 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-47.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-47.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_47'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-48.test.js b/test/sgp4/full-catalog/sgp4-catalog-48.test.js index b7a4827..48978b4 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-48.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-48.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_48'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-49.test.js b/test/sgp4/full-catalog/sgp4-catalog-49.test.js index 25341e2..809203d 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-49.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-49.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_49'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-5.test.js b/test/sgp4/full-catalog/sgp4-catalog-5.test.js index 6fb5b94..6d3a2a7 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-5.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-5.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_5'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-50.test.js b/test/sgp4/full-catalog/sgp4-catalog-50.test.js index 447c72f..9860aa0 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-50.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-50.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_50'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-6.test.js b/test/sgp4/full-catalog/sgp4-catalog-6.test.js index 6266743..44cecb2 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-6.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-6.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_6'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-7.test.js b/test/sgp4/full-catalog/sgp4-catalog-7.test.js index 1bd5689..61ba350 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-7.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-7.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_7'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-8.test.js b/test/sgp4/full-catalog/sgp4-catalog-8.test.js index a379e1e..468b289 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-8.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-8.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_8'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4-catalog-9.test.js b/test/sgp4/full-catalog/sgp4-catalog-9.test.js index 09e58ec..4e1a41b 100644 --- a/test/sgp4/full-catalog/sgp4-catalog-9.test.js +++ b/test/sgp4/full-catalog/sgp4-catalog-9.test.js @@ -11,7 +11,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_9'; const rawData = fs.readFileSync(`test/sgp4/full-catalog/${fileName}.json`, 'utf8'); diff --git a/test/sgp4/full-catalog/sgp4TestMaker.mjs b/test/sgp4/full-catalog/sgp4TestMaker.mjs index 4015652..0ce4334 100644 --- a/test/sgp4/full-catalog/sgp4TestMaker.mjs +++ b/test/sgp4/full-catalog/sgp4TestMaker.mjs @@ -17,7 +17,7 @@ import * as fs from 'fs'; /** * sgp4Data is from SGP4Prop 8.3 Build: Apr 27 2022 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; const fileName = 'TLE_${f}'; const rawData = fs.readFileSync(\`test/sgp4/full-catalog/\${fileName}.json\`, 'utf8'); diff --git a/test/sgp4/legacy/ext.test.js b/test/sgp4/legacy/ext.test.js index 169431c..cdc108b 100644 --- a/test/sgp4/legacy/ext.test.js +++ b/test/sgp4/legacy/ext.test.js @@ -3,7 +3,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; describe('Julian date / time', () => { // Use number of milliseconds since epoch instead of local year, month, day, etc for consistency across machines diff --git a/test/sgp4/legacy/initl.test.js b/test/sgp4/legacy/initl.test.js index f972b41..3f27a08 100644 --- a/test/sgp4/legacy/initl.test.js +++ b/test/sgp4/legacy/initl.test.js @@ -3,7 +3,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '../../../lib/ootk-core'; // eslint-disable-line +import { Sgp4 } from '../../../lib/index'; // eslint-disable-line // wgs84 constants const mu = 398600.8; // in km3 / s2 diff --git a/test/sgp4/legacy/io.test.js b/test/sgp4/legacy/io.test.js index 0864c72..e31f1b7 100644 --- a/test/sgp4/legacy/io.test.js +++ b/test/sgp4/legacy/io.test.js @@ -3,7 +3,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '../../../src/ootk-core'; // eslint-disable-line +import { Sgp4 } from '../../../lib/index'; import badTleData from './io.json'; describe('Twoline', () => { diff --git a/test/sgp4/rsr/rsr3.test.js b/test/sgp4/rsr/rsr3.test.js index e4fa866..3572c01 100644 --- a/test/sgp4/rsr/rsr3.test.js +++ b/test/sgp4/rsr/rsr3.test.js @@ -8,7 +8,7 @@ * sgp4Data is from https://www.celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753-Rev1.pdf * Only using the first and last state vectors for verification */ -import { Sgp4 } from '../../../lib/ootk-core'; +import { Sgp4 } from '../../../lib/index'; import { compareVectors } from '../../lib/compareVectors'; import sgp4FailData from './rsr3-fail.json'; import sgp4Data from './rsr3.json'; diff --git a/test/sgp4/sgp4-full-cov.test.js b/test/sgp4/sgp4-full-cov.test.js index 3210965..ccc791b 100644 --- a/test/sgp4/sgp4-full-cov.test.js +++ b/test/sgp4/sgp4-full-cov.test.js @@ -4,7 +4,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '../../lib/ootk-core'; +import { Sgp4 } from '../../lib/index'; import sgp4FailData from './sgp4-full-cov-fail.json'; import sgp4Data from './sgp4-full-cov.json'; diff --git a/test/sun-moon/sun-moon.test.ts b/test/sun-moon/sun-moon.test.ts index f01b961..0609566 100644 --- a/test/sun-moon/sun-moon.test.ts +++ b/test/sun-moon/sun-moon.test.ts @@ -7,7 +7,7 @@ import { Celestial } from '../../lib/body/Celestial'; import { Moon } from '../../lib/body/Moon'; import { Sun } from '../../lib/body/Sun'; -import { Degrees, Meters } from '../../lib/ootk-core'; +import { Degrees, Meters } from '../../lib/index'; // Use number of milliseconds since epoch instead of local year, month, day, etc for consistency across machines const dateObj = new Date(1661400000000); diff --git a/test/tle/tle.test.ts b/test/tle/tle.test.ts index 6fc4e4c..d0c4236 100644 --- a/test/tle/tle.test.ts +++ b/test/tle/tle.test.ts @@ -5,7 +5,7 @@ * @since 1.1.0 */ -import { Tle } from '../../lib/ootk-core'; +import { Tle } from '../../lib/index'; import { tleData } from './tleData'; describe('Valid TLEs', () => { diff --git a/test/tle/tleData.ts b/test/tle/tleData.ts index c9751fa..8e1ccfd 100644 --- a/test/tle/tleData.ts +++ b/test/tle/tleData.ts @@ -1,4 +1,4 @@ -import { TleLine1, TleLine2 } from 'lib/ootk-core'; +import { TleLine1, TleLine2 } from 'lib/index'; export const tleData = [ { diff --git a/test/transforms/transforms.test.ts b/test/transforms/transforms.test.ts index 6643dc7..fd4b848 100644 --- a/test/transforms/transforms.test.ts +++ b/test/transforms/transforms.test.ts @@ -12,7 +12,7 @@ import { lla2ecf, rae2ecf, rae2sez, -} from '../../lib/ootk-core'; +} from '../../lib/index'; import { transformsData } from './transformsData'; const numDigits = 6; diff --git a/test/transforms/transformsData.ts b/test/transforms/transformsData.ts index 643c16c..8cbaa12 100644 --- a/test/transforms/transformsData.ts +++ b/test/transforms/transformsData.ts @@ -1,4 +1,4 @@ -import { Degrees, EcfVec3, EciVec3, Kilometers, RAD2DEG, Radians } from '../../lib/ootk-core'; +import { Degrees, EcfVec3, EciVec3, Kilometers, RAD2DEG, Radians } from '../../lib/index'; export const transformsData = { validLatitudes: [ diff --git a/test/utils/utils.test.ts b/test/utils/utils.test.ts index a2e7c5d..d9a513c 100644 --- a/test/utils/utils.test.ts +++ b/test/utils/utils.test.ts @@ -3,7 +3,7 @@ * @since 1.0.0-alpha3 */ -import { EciVec3, Kilometers, linearDistance, Vec3 } from '../../lib/ootk-core'; // eslint-disable-line +import { EciVec3, Kilometers, linearDistance, Vec3 } from '../../lib/index'; // eslint-disable-line import { dopplerFactor, getDayOfYear } from '../../lib/utils/functions'; const numDigits = 8; diff --git a/tsconfig.build.json b/tsconfig.build.json index db4cf6a..6263796 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -10,7 +10,8 @@ "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, "plugins": [{ "transform": "typescript-transform-paths" }], "declaration": true, - "isolatedModules": true + "isolatedModules": true, + "strict": true }, "include": ["./src/**/*.ts"], "filesGlob": ["./src/**/*.ts"]