fix(firms): drop the decimal when fire power rounds to 10 MW

A 9.96 MW detection was labeled 10.0 MW because the one-decimal cutoff ran before rounding.
This commit is contained in:
Rudy Celekli committed 2026-10-24 00:23:11 -04:00
1 parent 9d3548c27c
commit 2beef9be39
4 files changed
+40 -3

No files matched your search

+11
View File
@@ -39,6 +39,17 @@ export function accentForSeverity(stopName) {
return ACCENT_RGB[stopName] || ACCENT_RGB.yellow;
}
/**
* Fire radiative power as shown on a card: "9.9" below 10 MW, "10" once
* one-decimal rounding reaches 10. "10.0" would sit beside a whole "10".
* @param {number} frp Megawatts.
* @returns {string}
*/
export function formatFrpMw(frp) {
const digits = Number(Number(frp).toFixed(1)) >= 10 ? 0 : 1;
return Number(frp).toFixed(digits);
}
/** Raw FIRMS satellite code → short display name (N = Suomi NPP). */
export function satelliteShortName(satellite) {
const s = String(satellite || '')