Added daytime property
This commit is contained in:
@@ -68,7 +68,7 @@ function dir(deg: number) {
|
|||||||
<span>↑{{ ~~(d.temperature_max) + '°' || '—' }}</span>
|
<span>↑{{ ~~(d.temperature_max) + '°' || '—' }}</span>
|
||||||
<span class="day-low">↓{{ ~~(d.temperature_min) + '°' || '—' }}</span>
|
<span class="day-low">↓{{ ~~(d.temperature_min) + '°' || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="day-humid">🌡️ {{ d.humidity || 0 }}%</div>
|
<div class="day-humid">🌡️ {{ ~~(d.humidity) || 0 }}%</div>
|
||||||
<div class="day-wind">🍃 {{ ~~(d.wind_gusts as any) || 0 }} Kph ({{dir(d.wind_dir as any)}})</div>
|
<div class="day-wind">🍃 {{ ~~(d.wind_gusts as any) || 0 }} Kph ({{dir(d.wind_dir as any)}})</div>
|
||||||
<div class="day-rain">🌧️ {{ d.precipitation_chance || 0 }}% ({{ (d.precipitation as any || 0).toFixed(1) }}mm)</div>
|
<div class="day-rain">🌧️ {{ d.precipitation_chance || 0 }}% ({{ (d.precipitation as any || 0).toFixed(1) }}mm)</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export async function get24HourForecast(currentSensors) {
|
|||||||
const wind_speed = forecastWind(seedWind, pressureTrend);
|
const wind_speed = forecastWind(seedWind, pressureTrend);
|
||||||
|
|
||||||
const snapshot = {
|
const snapshot = {
|
||||||
time: time.toISOString().slice(0, 16), // "YYYY-MM-DDTHH:MM"
|
time,
|
||||||
daytime: false,
|
daytime: false,
|
||||||
temperature,
|
temperature,
|
||||||
humidity,
|
humidity,
|
||||||
@@ -205,7 +205,7 @@ function summarise(slots) {
|
|||||||
|
|
||||||
// Most frequent label/code by occurrence
|
// Most frequent label/code by occurrence
|
||||||
const labelCount = {}
|
const labelCount = {}
|
||||||
for (const s of slots.filter(s => s.daytime)) labelCount[s.label] = (labelCount[s.label] || 0) + 1
|
for (const s of slots) labelCount[s.label] = (labelCount[s.label] || 0) + 1
|
||||||
const label = Object.entries(labelCount).sort((a, b) => b[1] - a[1])[0][0]
|
const label = Object.entries(labelCount).sort((a, b) => b[1] - a[1])[0][0]
|
||||||
const dominant = slots.find(s => s.label === label)
|
const dominant = slots.find(s => s.label === label)
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ export async function dailyWeather(lat, lon, start, end) {
|
|||||||
icon,
|
icon,
|
||||||
code,
|
code,
|
||||||
time,
|
time,
|
||||||
daytime: !!data.daily.sunrise[i],
|
|
||||||
temperature: temp,
|
temperature: temp,
|
||||||
temperature_max: temp,
|
temperature_max: temp,
|
||||||
temperature_min: data.daily.temperature_2m_min[i],
|
temperature_min: data.daily.temperature_2m_min[i],
|
||||||
|
|||||||
Reference in New Issue
Block a user