mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 16:52:20 +00:00
Every Cesium read that a Navara page made was surveyed with the strict acceptance (GEV_QA_CESIUM_TRAP=record). Math on those paths now uses src/geo: screen annotations, weather and wind center readings, cyclone picks, scene data pack polygons and images (new navaraGeometry.js), the awareness subject, the orbit offset of camera verbs, voice frame_overhead, the agent world packet and Directions colours and ground picks. The celestial ring's Sun and Moon come from a bit-identical port of Cesium's Simon1994 model, JulianDate and TEME rotation (src/geo/simon1994.js, julianDate.js, transforms.js); a Cesium globe still applies its ICRF rotation once loaded. Traffic, Street Level, the Nepal event and locator and geo import build on Cesium's math or entity model on either globe; their enable (or the import) now loads the SDK first through src/app/loadCesium.js, synchronously when it is already there. A production page guards the global so a missed read is reported and starts the load. No module reads Cesium while it loads (scripts/check-cesium-load-time.mjs, run by npm test). Cesium.js is still loaded by index.html here.
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import * as geo from '../../geo/index.js';
|
|
import {
|
|
windFrom,
|
|
formatWindSpeed,
|
|
inspectWindAtCenter,
|
|
} from './inspection.js';
|
|
|
|
test('wind directions describe the source of the flow and calm is not north', () => {
|
|
assert.equal(windFrom(10, 0), 'W');
|
|
assert.equal(windFrom(-10, 0), 'E');
|
|
assert.equal(windFrom(0, 10), 'S');
|
|
assert.equal(windFrom(0, -10), 'N');
|
|
assert.equal(windFrom(0, 0), 'Calm');
|
|
assert.equal(formatWindSpeed(10, 'km/h'), '36.0 km/h');
|
|
assert.equal(formatWindSpeed(10, 'mph'), '22.4 mph');
|
|
});
|
|
test('center inspection uses a fixed forecast reading without double-converting scalar units', () => {
|
|
const snapshot = {
|
|
grid: { nx: 2, ny: 2, lo1: 0, la1: 90, dx: 180, dy: 180 },
|
|
u: Float32Array.from([10, 10, 10, 10]),
|
|
v: new Float32Array(4),
|
|
scalar: {
|
|
kind: 'temperature',
|
|
units: '°C',
|
|
values: Float32Array.from([20, 20, 20, 20]),
|
|
},
|
|
};
|
|
const viewer = {
|
|
camera: { pickEllipsoid: () => geo.cartesian3.fromDegrees(0, 0) },
|
|
scene: { canvas: { clientWidth: 800, clientHeight: 600 } },
|
|
};
|
|
const result = inspectWindAtCenter(snapshot, viewer, {
|
|
overlay: 'temperature',
|
|
units: 'km/h',
|
|
model: 'GFS',
|
|
validTime: 'fixed',
|
|
status: 'forecast',
|
|
});
|
|
assert.equal(result.wind, '36.0 km/h from W');
|
|
assert.equal(result.scalarValue, '20.0 °C');
|
|
assert.equal(result.validTime, 'fixed');
|
|
assert.equal(result.coordinates, '0.00°N · 0.00°E');
|
|
viewer.camera.pickEllipsoid = () => null;
|
|
assert.equal(
|
|
inspectWindAtCenter(snapshot, viewer).coordinates,
|
|
'No surface reading',
|
|
);
|
|
});
|