mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(tools): average aircraft speed over airborne aircraft only
aircraft_in_area stats summarized altitude over airborne aircraft but speed over every match, so parked aircraft pulled the mean speed toward zero. Both figures now use the same airborne subset, and the on-ground fixture is stationary so the test can tell the difference. Reserved AIS ship-type codes 100 to 255 now read as unknown, as type 0 does, instead of showing up in the breakdown as their own type. Adds tests for an area where every aircraft is on the ground and for find_vessel type and destination normalization, and notes in the changelog fragment that every vessel answer is now normalized. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d39256e700
commit
4c383214f7
6 files changed
+112
-19
No files matched your search
@@ -297,6 +297,60 @@ test('numeric AIS ship-type codes group and filter by their family', async () =>
|
||||
);
|
||||
});
|
||||
|
||||
test('reserved AIS ship-type codes 100 to 255 count as unknown', async () => {
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
services: {
|
||||
vessels: vessels({
|
||||
records: [
|
||||
vessel('366000001', 37.78, -122.4, { type: '100' }),
|
||||
vessel('366000002', 37.79, -122.41, { type: '255' }),
|
||||
vessel('366000003', 37.77, -122.39, { type: '70' }),
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
const result = await catalog.call('vessels_in_area', {
|
||||
area: bay,
|
||||
group_by: 'type',
|
||||
});
|
||||
assert.deepEqual(result.data.breakdown.groups, [
|
||||
{ value: 'CARGO', count: 1 },
|
||||
]);
|
||||
assert.equal(result.data.breakdown.unknown_count, 2);
|
||||
assert.doesNotMatch(result.summary, /\b(100|255) \(/);
|
||||
});
|
||||
|
||||
test('find_vessel answers carry normalized types and destinations', async () => {
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
services: {
|
||||
vessels: vessels({
|
||||
records: [
|
||||
vessel('366000001', 37.78, -122.4, {
|
||||
type: '71',
|
||||
destination: '---',
|
||||
}),
|
||||
vessel('366000002', 37.79, -122.41, {
|
||||
type: '0',
|
||||
destination: 'NLRTM',
|
||||
}),
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
const cargo = await catalog.call('find_vessel', { mmsi: '366000001' });
|
||||
assert.deepEqual(
|
||||
cargo.data.rows.map((row) => [row.type, row.destination]),
|
||||
[['CARGO', null]],
|
||||
);
|
||||
const unknown = await catalog.call('find_vessel', { mmsi: '366000002' });
|
||||
assert.deepEqual(
|
||||
unknown.data.rows.map((row) => [row.type, row.destination]),
|
||||
[[null, 'NLRTM']],
|
||||
);
|
||||
});
|
||||
|
||||
test('a destination with no letters counts as unknown', async () => {
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
|
||||
Reference in new issue
Block a user