mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(satellites): file satellites under six classes with a toggle each
The satellites layer now sorts every object into Stations, Imaging, Telecom, Starlink, Probes or Debris, each with a chip and a live count on the layer row. Stations and Imaging show by default; the Starlink chip is the former DENSE catalog switch. Hidden classes keep their points, so a toggle needs no reload, and they leave the detection overlay and the voice position lists. A class comes, strongest evidence first, from CelesTrak SATCAT (object type and status, served by a new /api/celestrak-satcat/<group> proxy route and cached for a day), the bundled UCS Satellite Database pack (operator, owner country and purpose), name patterns for later launches, and the CelesTrak group. The core catalog also reads the resource, weather, planet, sar and science groups. Payloads with no evidence of life launched 20 or more years ago are filed as debris. The UCS pack, its build script and its data credit are added.
This commit is contained in:
1 parent
1b9bb844e6
commit
c56f098d07
44 files changed
+2530
-362
No files matched your search
@@ -0,0 +1,84 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { indexUcsPack, loadUcsSatellites } from './ucsSatellites.js';
|
||||
|
||||
const PACK_URL = new URL(
|
||||
'./local_data/ucs_satellites/ucs_satellites.json',
|
||||
import.meta.url,
|
||||
);
|
||||
|
||||
test('the bundled UCS pack names its release, licence and curation', () => {
|
||||
const pack = JSON.parse(readFileSync(PACK_URL, 'utf8'));
|
||||
assert.equal(pack.meta.version, 'UCS-Satellite-Database 5-1-2023');
|
||||
assert.equal(pack.meta.url, 'https://www.ucsusa.org/satellite_database');
|
||||
assert.equal(pack.meta.dataCurrentTo, '2023-05-01');
|
||||
assert.match(pack.meta.license, /unrestricted/);
|
||||
assert.equal(pack.meta.recordCount, pack.records.length);
|
||||
assert.equal(
|
||||
pack.meta.curation.sourceRows,
|
||||
pack.records.length +
|
||||
pack.meta.curation.starlinkRowsDropped +
|
||||
pack.meta.curation.invalidNoradDropped +
|
||||
pack.meta.curation.duplicateNoradDropped,
|
||||
);
|
||||
assert.deepEqual(pack.fields, [
|
||||
'noradId',
|
||||
'operator',
|
||||
'operatorCountry',
|
||||
'purpose',
|
||||
'detailedPurpose',
|
||||
'users',
|
||||
'orbitClass',
|
||||
]);
|
||||
// Small enough to load with the layer.
|
||||
assert.ok(readFileSync(PACK_URL).length < 200_000);
|
||||
});
|
||||
|
||||
test('the pack loads into records keyed by NORAD number', async () => {
|
||||
const records = await loadUcsSatellites();
|
||||
assert.equal(records, await loadUcsSatellites(), 'loaded once');
|
||||
const iss = records.get(25544);
|
||||
assert.ok(iss, 'the ISS is in UCS');
|
||||
assert.equal(iss.noradId, 25544);
|
||||
assert.ok(iss.operator);
|
||||
assert.ok(iss.purpose);
|
||||
for (const record of records.values()) {
|
||||
assert.doesNotMatch(
|
||||
`${record.operator ?? ''} ${record.purpose ?? ''}`,
|
||||
/starlink/i,
|
||||
'Starlink rows are dropped',
|
||||
);
|
||||
if (record.orbitClass) assert.match(record.orbitClass, /^(LEO|MEO|GEO|ELLIPTICAL)$/);
|
||||
}
|
||||
});
|
||||
|
||||
test('indexing reads the string tables and turns empty strings into null', () => {
|
||||
const records = indexUcsPack({
|
||||
fields: ['noradId', 'operator', 'purpose'],
|
||||
strings: { operator: ['', 'ESA'], purpose: ['', 'Earth Observation'] },
|
||||
records: [
|
||||
[39634, 1, 1],
|
||||
[40000, 0, 1],
|
||||
['bad', 1, 1],
|
||||
[-5, 1, 1],
|
||||
],
|
||||
});
|
||||
assert.deepEqual([...records.keys()], [39634, 40000]);
|
||||
assert.deepEqual(records.get(39634), {
|
||||
noradId: 39634,
|
||||
operator: 'ESA',
|
||||
purpose: 'Earth Observation',
|
||||
});
|
||||
assert.equal(records.get(40000).operator, null);
|
||||
});
|
||||
|
||||
test('a pack of the wrong shape throws, so the loader tries again', () => {
|
||||
// Read as empty, it would be cached for the session as a success.
|
||||
assert.throws(() => indexUcsPack(null), TypeError);
|
||||
assert.throws(
|
||||
() => indexUcsPack({ fields: ['name'], records: [[1]] }),
|
||||
TypeError,
|
||||
);
|
||||
assert.throws(() => indexUcsPack({ fields: ['noradId'] }), TypeError);
|
||||
});
|
||||
Reference in new issue
Block a user