Mercurial > personal > weather-server
diff weather_server/static/graph.js @ 41:4af79d69b12e v0.2.0
Use units better suited for science.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 01 Apr 2025 16:04:52 -0400 |
parents | beedfa8eaa3f |
children |
line wrap: on
line diff
--- a/weather_server/static/graph.js Tue Apr 01 15:54:42 2025 -0400 +++ b/weather_server/static/graph.js Tue Apr 01 16:04:52 2025 -0400 @@ -10,11 +10,15 @@ define("math", ["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.dewPointC = exports.cToF = void 0; + exports.dewPointC = exports.cToK = exports.cToF = void 0; function cToF(tempC) { return tempC * 9 / 5 + 32; } exports.cToF = cToF; + function cToK(tempC) { + return tempC + 273.15; + } + exports.cToK = cToK; const MAGNUS_B = 17.62; const MAGNUS_C = 243.12; function gammaFn(tempC, rhPct) { @@ -48,8 +52,8 @@ return; root.classList.remove('plain'); root.classList.add('fancy'); - const tempsF = readings.map(s => [s.sample_time, math_1.cToF(s.temp_c)]); - const dewPointsF = readings.map(s => [s.sample_time, math_1.cToF(math_1.dewPointC(s.temp_c, s.rh_pct))]); + const tempsF = readings.map(s => [s.sample_time, (0, math_1.cToK)(s.temp_c)]); + const dewPointsF = readings.map(s => [s.sample_time, (0, math_1.cToK)((0, math_1.dewPointC)(s.temp_c, s.rh_pct))]); setUpElement(tempElement, [startTS, nowTS], tempsF); setUpElement(dewPointElement, [startTS, nowTS], dewPointsF); });