Skip to content

Commit 6287d35

Browse files
authored
update meteo weather model input processing and enhance documentation… (#20)
update meteo weather model input processing and enhance documentation regarding weather models
1 parent f14f640 commit 6287d35

File tree

3 files changed

+87
-13
lines changed

3 files changed

+87
-13
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM alpine:3.23.2
1+
FROM alpine:3.23.3
22

33
LABEL maintainer="Michael Oberdorf <info@oberdorf-itc.de>"
4-
LABEL site.local.program.version="1.4.0"
4+
LABEL site.local.program.version="1.5.0"
55

66
ENV TZ="UTC" \
77
REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \

README.md

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,12 @@ Container image: [DockerHub](https://hub.docker.com/r/oitc/weather2mqtt)
2626

2727
# Supported tags and respective `Dockerfile` links
2828

29-
* [`latest`, `1.4.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.4.0/Dockerfile)
29+
30+
* [`latest`, `1.5.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.5.0/Dockerfile)
31+
* [`1.4.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.4.0/Dockerfile)
3032
* [`1.3.4`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.4/Dockerfile)
31-
* [`1.3.3`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.3/Dockerfile)
32-
* [`1.3.1`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.1/Dockerfile)
33-
* [`1.3.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.0/Dockerfile)
3433
* [`1.2.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.2.0/Dockerfile)
3534
* [`1.1.1`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.1.1/Dockerfile)
36-
* [`1.1.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.1.0/Dockerfile)
37-
* [`1.0.2`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.0.2/Dockerfile)
38-
* [`1.0.0`](https://github.com/cybcon/docker.weather2mqtt/blob/v1.0.0/Dockerfile)
3935

4036
# Summary
4137
The application will make an [Open Meteo](https://open-meteo.com/) free weather API call to get weather information for the configured geo coordinates.
@@ -139,7 +135,7 @@ The container grab some configuration via environment variables.
139135
| `LATITUDE` | The geo coordinate latitude from where we want to have the weather. | optional | `48.72592` |
140136
| `LONGITUDE` | The geo coordinate longitude from where we want to have the weather. | optional | `9.11446` |
141137
| `ELEVATION` | The ground elevation from where we want to have the weather. | optional | |
142-
| `WEATHER_MODELS` | The weather model to use. | optional | |
138+
| `WEATHER_MODELS` | The weather model(s) to use as comma separated list (see below). | optional | |
143139
| `WEATHE_CODE_LANGUAGE` | Translation of the numeric weather code into the defined language ('en' or 'de') | optional | `en` |
144140
| `TZ` | The time zone to use to provide timestamps. | optional | `UTC` |
145141
| `MQTT_CLIENT_ID` | A MQTT client identifier. | optional | |
@@ -159,6 +155,79 @@ The container grab some configuration via environment variables.
159155
| `CACHE_EXPIRY_AFTER_SEC` | Cache expiration time in seconds. | optional | `600` |
160156
| `DEBUG` | Enable debug output log. | optional | `false` |
161157

158+
## Weather models
159+
160+
You can manually select one or more weather models. Per default, the best suitable weather models will be combined by [Open Meteo](https://open-meteo.com/).
161+
162+
To select one or more weather models, you need to define them via the model ID in the environment variable `WEATHER_MODELS`.
163+
164+
[Open Meteo](https://open-meteo.com/) supports, beside `best_match`, following 45 weather models:
165+
166+
| Model name | Model ID |
167+
|-----------------------------------------|-----------------------------------|
168+
| ECMWF IFS HRES 9km | `ecmwf_ifs` |
169+
| ECMWF IFS 0.25° | `ecmwf_ifs025` |
170+
| ECMWF AIFS 0.25° Single | `ecmwf_aifs025_single` |
171+
| CMA GRAPES Global | `cma_grapes_global` |
172+
| BOM ACCESS Global | `bom_access_global` |
173+
| DWD ICON Seamless | `icon_seamless` |
174+
| DWD ICON Global | `icon_global` |
175+
| DWD ICON EU | `icon_eu` |
176+
| DWD ICON D2 | `icon_d2` |
177+
| MET Norway Nordic Seamless (with ECMWF) | `metno_seamless` |
178+
| MET Norway Nordic | `metno_nordic` |
179+
| NCEP GFS Seamless | `gfs_seamless` |
180+
| NCEP GFS Global 0.11°/0.25° | `gfs_global` |
181+
| NCEP HRRR U.S. Conus | `gfs_hrrr` |
182+
| NCEP NBM U.S. Conus | `ncep_nbm_conus` |
183+
| NCEP NAM U.S. Conus | `ncep_nam_conus` |
184+
| GFS GraphCast | `gfs_graphcast025` |
185+
| GEM Seamless | `gem_seamless` |
186+
| GEM Global | `gem_global` |
187+
| GEM Regional | `gem_regional` |
188+
| GEM HRDPS Continental | `gem_hrdps_continental` |
189+
| GEM HRDPS West | `gem_hrdps_west` |
190+
| KNMI Seamless (with ECMWF) | `knmi_seamless` |
191+
| KNMI Harmonie Arome Europe | `knmi_harmonie_arome_europe` |
192+
| KNMI Harmonie Arome Netherlands | `knmi_harmonie_arome_netherlands` |
193+
| DMI Seamless (with ECMWF) | `dmi_seamless` |
194+
| DMI Harmonie Arome Europe | `dmi_harmonie_arome_europe` |
195+
| JMA Seamless | `jma_seamless` |
196+
| JMA MSM | `jma_msm` |
197+
| JMA GSM | `jma_gsm` |
198+
| Météo-France Seamless | `meteofrance_seamless` |
199+
| Météo-France ARPEGE World | `meteofrance_arpege_world` |
200+
| Météo-France ARPEGE Europe | `meteofrance_arpege_europe` |
201+
| Météo-France AROME France | `meteofrance_arome_france` |
202+
| Météo-France AROME France HD | `meteofrance_arome_france_hd` |
203+
| UK Met Office Seamless | `ukmo_seamless` |
204+
| UK Met Office Global 10km | `ukmo_global_deterministic_10km` |
205+
| UK Met Office UK 2km | `ukmo_uk_deterministic_2km` |
206+
| KMA Seamless | `kma_seamless` |
207+
| KMA LDPS | `kma_ldps` |
208+
| KMA GDPS | `kma_gdps` |
209+
| ItaliaMeteo ARPAE ICON 2I | `italia_meteo_arpae_icon_2i` |
210+
| MeteoSwiss ICON Seamless | `meteoswiss_icon_seamless` |
211+
| MeteoSwiss ICON CH1 | `meteoswiss_icon_ch1` |
212+
| MeteoSwiss ICON CH2 | `meteoswiss_icon_ch2` |
213+
214+
215+
### Examples
216+
217+
Examples on how to set one or more weather models.
218+
219+
**Single weather model:**
220+
221+
```
222+
export WEATHER_MODELS="icon_d2"
223+
```
224+
225+
**Multiple weather models:**
226+
227+
```
228+
export WEATHER_MODELS=icon_d2,icon_eu
229+
```
230+
162231
### .envrc example
163232

164233
If you use `direnv` to load your environment automatically.

src/app/bin/weather2mqtt.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Author: Michael Oberdorf
1212
# Date: 2025-04-11
1313
# Last modified by: Michael Oberdorf
14-
# Last modified at: 2026-01-18
14+
# Last modified at: 2026-01-31
1515
###############################################################################
1616
"""
1717

@@ -30,7 +30,7 @@
3030
from lib.weather_codes import WeatherCodes
3131
from retry_requests import retry # seeAlso: https://pypi.org/project/retry-requests/
3232

33-
__version__ = "1.4.0"
33+
__version__ = "1.5.0"
3434
__script_path__ = os.path.dirname(__file__)
3535
__config_path__ = os.path.join(os.path.dirname(__script_path__), "etc")
3636
__local_tz__ = pytz.timezone("UTC")
@@ -127,7 +127,12 @@ def load_config_file() -> dict:
127127
if os.environ.get("ELEVATION") is not None:
128128
config["data"]["elevation"] = float(os.environ.get("ELEVATION"))
129129
if os.environ.get("WEATHER_MODELS") is not None:
130-
config["data"]["models"] = os.environ.get("WEATHER_MODELS")
130+
config["data"]["models"] = os.environ.get("WEATHER_MODELS").replace(" ", "")
131+
if "[" in config["data"]["models"] and "]" in config["data"]["models"]:
132+
config["data"]["models"] = json.loads(config["data"]["models"])
133+
else:
134+
if "," in config["data"]["models"]:
135+
config["data"]["models"] = config["data"]["models"].split(",")
131136
if os.environ.get("TZ") is not None:
132137
config["data"]["timezone"] = os.environ.get("TZ")
133138

0 commit comments

Comments
 (0)