mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
Merge branch 'main' into fix/e-local-adsb-geom-rate
This commit is contained in:
commit
780d8903ee
810 files changed
+70590
-21526
No files matched your search
@@ -48,7 +48,8 @@ export function normalizeReadsbAircraft(row, snapshotTimeMs) {
|
||||
const baroFt = finite(row.alt_baro),
|
||||
geoFt = finite(row.alt_geom);
|
||||
const speedKts = finite(row.gs),
|
||||
rateFtMin = finite(row.baro_rate);
|
||||
// readsb sends a GNSS-sourced rate as geom_rate instead of baro_rate.
|
||||
rateFtMin = finite(row.baro_rate) ?? finite(row.geom_rate);
|
||||
const seen = finite(row.seen),
|
||||
seenPos = finite(row.seen_pos);
|
||||
return {
|
||||
|
||||
@@ -145,6 +145,20 @@ test('readsb units and position/contact ages are normalized once against the sou
|
||||
);
|
||||
});
|
||||
|
||||
test('readsb vertical rate falls back to the GNSS rate when no baro rate is sent', () => {
|
||||
// readsb reports the rate under geom_rate when the aircraft's source is
|
||||
// GNSS; 26 of 157 positioned rows in a live /v2/mil fetch had only that.
|
||||
const row = { hex: 'ae638d', lat: 20.3, lon: -158.5, geom_rate: -2432 };
|
||||
assert.equal(
|
||||
normalizeReadsbAircraft(row, now).verticalRateMps,
|
||||
-2432 * 0.00508,
|
||||
);
|
||||
assert.equal(
|
||||
normalizeReadsbAircraft({ ...row, baro_rate: -2400 }, now).verticalRateMps,
|
||||
-2400 * 0.00508,
|
||||
);
|
||||
});
|
||||
|
||||
test('vessel identity, opaque reference and heading/course remain distinct, unknowns stay null', () => {
|
||||
const row = normalizeVesselObservation(
|
||||
{
|
||||
|
||||
@@ -72,3 +72,16 @@ export function tleCatalogNumber(line) {
|
||||
const field = String(line).slice(2, 7);
|
||||
return decodeCatalogField(field.replace(/^ +/, ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch year from TLE line 1's international designator (columns 10-11);
|
||||
* null when the designator is blank.
|
||||
* @param {string} line1
|
||||
* @returns {number|null}
|
||||
*/
|
||||
export function tleLineLaunchYear(line1) {
|
||||
const digits = String(line1 || '').slice(9, 11);
|
||||
if (!/^\d{2}$/.test(digits)) return null;
|
||||
const shortYear = Number(digits);
|
||||
return shortYear >= 57 ? 1900 + shortYear : 2000 + shortYear;
|
||||
}
|
||||
Reference in new issue
Block a user