1.5.7
Profile memory Comment cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// weather-checks.js — Weather-derived event detectors.
|
||||
// ------------------------------------------------------------------------
|
||||
// weather-checks.js - Weather-derived event detectors.
|
||||
//
|
||||
// Computed in real-time from the forecast data.
|
||||
// Each checker function receives (rows [, location]) and returns an event
|
||||
@@ -9,7 +9,7 @@
|
||||
// To add a new weather event: write a checkXxx(rows, location) function
|
||||
// below, export it, and add it to the checks[] array inside
|
||||
// getActiveEvents() (in events.js).
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
export function checkStargazing(rows) {
|
||||
// Great stargazing: mostly clear night hours with low cloud
|
||||
@@ -31,7 +31,7 @@ export function checkStargazing(rows) {
|
||||
|
||||
export function checkSunset(rows, location) {
|
||||
// Find the actual sunset window: the LAST contiguous run of rows where
|
||||
// solar elevation is in the golden/civil-twilight band (-3° to 8°).
|
||||
// solar elevation is in the golden/civil-twilight band (-3- to 8-).
|
||||
// This distinguishes sunset from sunrise (which is the first such run).
|
||||
const twilightIndices = rows
|
||||
.map((r, i) => ({ r, i }))
|
||||
@@ -52,11 +52,11 @@ export function checkSunset(rows, location) {
|
||||
runs.push(run);
|
||||
|
||||
// Use the LAST run (sunset). If only one run exists it's either sunrise-only
|
||||
// or a single dusk window — use it but we'll label generically.
|
||||
// or a single dusk window - use it but we'll label generically.
|
||||
const sunsetRun = runs[runs.length - 1];
|
||||
const sunsetRows = sunsetRun.map(({ r }) => r);
|
||||
const isSunrise = runs.length === 1 && sunsetRows[0].elev < sunsetRows[sunsetRows.length - 1].elev;
|
||||
// If sun is rising through the band this is a sunrise window, not sunset — skip.
|
||||
// If sun is rising through the band this is a sunrise window, not sunset - skip.
|
||||
if (isSunrise) return null;
|
||||
|
||||
const avgCloud = sunsetRows.reduce((s, r) => s + r.cc, 0) / sunsetRows.length;
|
||||
|
||||
Reference in New Issue
Block a user