Files
gods-eye-view/src/data/firmsLabels.test.mjs
T
German KhokhlovandClaude Fable 5.1 38d29f2beb feat(fires): FRP intensity filter, confidence switch and six-stop color ramp (HAL-676)
Color every FIRMS detection by fire radiative power on the Portolan
cold → hot ramp (blue · teal · lime · amber · orange · red at
0 · 5 · 20 · 50 · 100 · 300 MW), replacing the three warm stops that
made a 2 MW and a 40 MW fire look alike. Heat cells, glow sprites and
card accents all read the same ramp (src/data/firmsIntensity.js).

Add a minimum-FRP log slider whose track is painted with the ramp (so
it doubles as the legend), an All / Nominal+ / High confidence switch
and an "N of M shown" counter to the Active Fires row. The filter runs
once in ingestion.applyFilter(), so markers, cards, heat cells, the
context store, the top-fires query and the analyst records all see one
set. Default is 0 MW / All: many of the strongest fires are rated low.

Persist both options in the layer state (token w: minFrp `f`,
confidence `c`), including the short share codec, and give the agent's
get_active_fires tool matching min_frp_mw / confidence arguments.

Layer panel gains generic `slider` and `segmented` row descriptors
(src/ui/rowFilterControls.js). New strings in es / ru / zh-CN.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-27 13:09:32 +04:00

51 lines
2.0 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import {
accentForSeverity,
FIRMS_AMBIENT_COHORT_LIMIT,
FIRMS_OVERLAY_SOURCE_ID,
satelliteShortName,
formatFrpMw,
} from './firmsLabels.js';
test('FIRMS card accents are the six FRP ramp stops, coldest as the fallback', () => {
// Portolan hue order; blue #4a5bd4 … red #d1382a (HAL-675).
assert.equal(accentForSeverity('blue'), '74, 91, 212');
assert.equal(accentForSeverity('teal'), '57, 160, 168');
assert.equal(accentForSeverity('lime'), '201, 207, 74');
assert.equal(accentForSeverity('amber'), '242, 177, 52');
assert.equal(accentForSeverity('orange'), '232, 114, 44');
assert.equal(accentForSeverity('red'), '209, 56, 42');
assert.equal(accentForSeverity('yellow'), accentForSeverity('blue'));
assert.equal(accentForSeverity('chartreuse'), accentForSeverity('blue'));
});
test('FIRMS power that rounds to 10 MW drops the decimal', () => {
assert.equal(formatFrpMw(9.96), '10');
assert.equal(formatFrpMw(9.94), '9.9');
assert.equal(formatFrpMw(0.8), '0.8');
assert.equal(formatFrpMw(1520.27), '1520');
assert.equal(formatFrpMw(210.4), '210');
});
test('FIRMS satellite names retain the three VIIRS abbreviations', () => {
assert.equal(satelliteShortName('N20'), 'N20');
assert.equal(satelliteShortName('N21'), 'N21');
assert.equal(satelliteShortName('N'), 'SNPP');
assert.equal(satelliteShortName('TERRA-X9'), 'TERRA-');
assert.equal(satelliteShortName(''), '');
});
test('FIRMS host registration constants pin the shipped source budget', () => {
assert.equal(FIRMS_OVERLAY_SOURCE_ID, 'firms');
assert.equal(FIRMS_AMBIENT_COHORT_LIMIT, 18);
});
test('FIRMS helper module cannot resurrect a dedicated canvas renderer', () => {
const source = readFileSync(new URL('./firmsLabels.js', import.meta.url), 'utf8');
assert.doesNotMatch(source, /createElement\(['"]canvas['"]\)/);
assert.doesNotMatch(source, /postRender/);
assert.doesNotMatch(source, /worldToWindowCoordinates/);
});