clouds: advect cloud field with Open-Meteo wind
This commit is contained in:
1 parent
0d8a5f93d3
commit
45e35982da
3 files changed
+73
-16
No files matched your search
+29
-4
@@ -2133,8 +2133,8 @@ window.weatherThemes = {
|
||||
function fetchWeather() {
|
||||
var url = 'https://api.open-meteo.com/v1/forecast?latitude=' + WEATHER_LAT +
|
||||
'&longitude=' + WEATHER_LON +
|
||||
'¤t=temperature_2m,relative_humidity_2m,weather_code,wind_speed_10m' +
|
||||
'&hourly=temperature_2m,weather_code' +
|
||||
'¤t=temperature_2m,relative_humidity_2m,weather_code,wind_speed_10m,wind_direction_10m' +
|
||||
'&hourly=temperature_2m,weather_code,wind_speed_10m,wind_direction_10m' +
|
||||
'&daily=weather_code,temperature_2m_max,temperature_2m_min' +
|
||||
'&timezone=Europe/Berlin&forecast_days=5';
|
||||
|
||||
@@ -2147,6 +2147,10 @@ window.weatherThemes = {
|
||||
window.BackgroundCache.put('meta/weather', { json: data });
|
||||
}
|
||||
currentWeatherCode = data.current.weather_code;
|
||||
window.__currentWind = {
|
||||
speedKmh: Number(data.current.wind_speed_10m || 0),
|
||||
dirDeg: Number(data.current.wind_direction_10m || 0)
|
||||
};
|
||||
// while the weather sim runs it owns the theme - a live
|
||||
// poll must not override the configured test weather
|
||||
if (!__weatherSimActive)
|
||||
@@ -2163,6 +2167,10 @@ window.weatherThemes = {
|
||||
weatherData = rec.json;
|
||||
window.__weatherStale = true;
|
||||
currentWeatherCode = rec.json.current.weather_code;
|
||||
window.__currentWind = {
|
||||
speedKmh: Number(rec.json.current.wind_speed_10m || 0),
|
||||
dirDeg: Number(rec.json.current.wind_direction_10m || 0)
|
||||
};
|
||||
if (!__weatherSimActive)
|
||||
setWeatherTheme(getWeatherThemeName(currentWeatherCode));
|
||||
updateWeatherDisplay();
|
||||
@@ -2220,6 +2228,12 @@ window.weatherThemes = {
|
||||
var curIdx = findHourlyIndex(eff, hourly.time);
|
||||
curTemp = hourly.temperature_2m[curIdx];
|
||||
curCode = hourly.weather_code[curIdx];
|
||||
if (hourly.wind_speed_10m && hourly.wind_direction_10m) {
|
||||
window.__currentWind = {
|
||||
speedKmh: Number(hourly.wind_speed_10m[curIdx] || 0),
|
||||
dirDeg: Number(hourly.wind_direction_10m[curIdx] || 0)
|
||||
};
|
||||
}
|
||||
if (!__weatherSimActive && curCode !== currentWeatherCode) {
|
||||
currentWeatherCode = curCode;
|
||||
setWeatherTheme(getWeatherThemeName(curCode));
|
||||
@@ -2231,9 +2245,20 @@ window.weatherThemes = {
|
||||
var tempDisplay = currentUnits === 'imperial'
|
||||
? Math.round(curTemp * 9 / 5 + 32) + '\u00b0F'
|
||||
: Math.round(curTemp) + '\u00b0C';
|
||||
var curWindSpeed = current.wind_speed_10m;
|
||||
var curWindDir = current.wind_direction_10m;
|
||||
if (SIM_ACTIVE && hourly.wind_speed_10m && hourly.wind_direction_10m) {
|
||||
var curIdx = findHourlyIndex(eff, hourly.time);
|
||||
curWindSpeed = hourly.wind_speed_10m[curIdx];
|
||||
curWindDir = hourly.wind_direction_10m[curIdx];
|
||||
}
|
||||
window.__currentWind = {
|
||||
speedKmh: Number(curWindSpeed || 0),
|
||||
dirDeg: Number(curWindDir || 0)
|
||||
};
|
||||
var windDisplay = currentUnits === 'imperial'
|
||||
? Math.round(current.wind_speed_10m * 0.621371) + ' mph'
|
||||
: Math.round(current.wind_speed_10m) + ' km/h';
|
||||
? Math.round(curWindSpeed * 0.621371) + ' mph'
|
||||
: Math.round(curWindSpeed) + ' km/h';
|
||||
var currentHtml = '<div class="weather-current-icon">' + weatherSVG(curCode) + '</div>' +
|
||||
'<div><div class="weather-current-temp"><span>' + tempDisplay + '</span><span class="weather-location" id="weather-location">' +
|
||||
((window.CONFIG && window.CONFIG.location && (window.CONFIG.location.label || (window.CONFIG.location.lat.toFixed(2) + ',' + window.CONFIG.location.lon.toFixed(2)))) || '') + '</span></div>' +
|
||||
|
||||
Reference in new issue
Block a user