-
Notifications
You must be signed in to change notification settings - Fork 4
Open‐Meteo (English)
Open-Meteo is an open-source weather API, that can be used for free in non-commercial domain. It provides forecast and historical data from various weather services including NOAA, DWD, Meteofrance, MSC-CSC etc. No API key is required to use the service.
weewx-DWD supports retrieving actual weather data from Open-Meteo by their API. Open-Meteo focusses on forecasts and historical data, but current data are also available.
The configuration is simple. Specify latitude and longitude. The configuration section in weewx.conf could look like this:
[WeatherServices]
[[current]]
[[[FichtelbergOM]]]
provider = Open-Meteo
model = LIST_OF_WEATHER_MODELS
latitude = 50.4283
longitude = 12.9536
altitude = 1213
iconset = 4
prefix = 'xyz'
This would retrieve current weather data for mount Fichtelberg in Saxony. You can specify any other location around the world.
The prefix is set to xyz
in this example. This means, if you want to display the temperature you would write $current.xyzOutTemp
in the skin template. $current.xyzIcon.raw
provides an icon file name, and $current.xyzIcontitle.raw
a text message describing the current weather.
Observation types (replace prefix
by the prefix you set in configuration):
prefixDateTime
prefixOutTemp
prefixWindSpeed
prefixWindDir
prefixWeathercode
prefixIcon
prefixIcontitle
prefixLatitude
prefixLongitude
prefixAltitude
To download forecast data und create forecasts a separate script is used which will be invoked from the command line.
For WeeWX packet installation:
dwd-mosmix --weewx --open-meteo=LIST_OF_WEATHER_MODELS --lang=LANGUAGE OUTPUTOPTIONS LATITUDE,LONGITUDE
For WeeWX pip installation:
dwd-mosmix --config=/path/to/your/weewx.conf --open-meteo=LIST_OF_WEATHER_MODELS --lang=LANGUAGE OUTPUTOPTIONS LATITUDE,LONGITUDE
OUTPUTOPTIONS
can be any combination of the following options:
-
--html --daily --hourly
: create HTML include files containing the weather forecast as a table -
--database
: create a database file containing the forecast data for displaying diagrams -
--belchertown
: create a Belchertown formatforecast.json
file
Layout options if used together with --html
:
-
--orientation
: orientation of the forecast table horizontal (H
), vertical (V
) or both (H,V
) (optional, defaultH,V
) -
--icon-set
: icon set to use for weather symbols, possible valuesbelchertown
(default),dwd
,aeris
,svg
(optional) -
--hide-placemark
: if set, do not put the location name above the table (optional) -
--hours=COUNT
: if used together with--hourly
amount of hours to include in the forecast, from now on (optional, default 11) -
--us
: if set, use U.S. units instead of metric units (optional)
Weekday names and compass directions are available in English (en
), german (de
), french (fr
), czech (cz
), polish (pl
), italian (it
) and dutch (nl
).
Use dwd-mosmix --help
for a complete list of options.
To download the forecast automatically put the call to dwd-mosmix
into /etc/crontab
.
Besides using command line parameters it is possible to put options into weewx.conf
. One option is required: the setting of the icon path. Other options are optional.
[WeatherServices]
[[forecast]]
# location of the icons on the web server
icons = '../images'
# which icon set to use: belchertown, dwd, aeris
icon_set = belchertown
# which orientation(s) shall be created in HTML?
orientation = h,v
# show observation type icons in HTML
#show_obs_symbols = True # optional
# show observation type description in HTML
#show_obs_description = False # optional
# show place name above the forecast table in HTML
#show_placemark = True # optional
[[[openmeteo-LATITUDE-LONGITUDE-MODEL]]]
provider = open-meteo
model = MODEL
# which observations to include in forecast table (optional)
observations_daily = ww,TX,TN,heatindex,FFavg,DDavg,RR1c,Rd10,PPPPavg,Neffavg,Rad1hsum
-
pre-formatted forecast table:
This will be created if you use the option
--html
.daily forecast:
#include raw "SUBDIRECTORY/forecast-openmeteo-LATITUDE-LONGITUDE.inc"
hourly forecast:
#include raw "SUBDIRECTORY/forecast-openmeteo-LATITUDE-LONGITUDE-hourly.inc"
horizontal, metric units vertical, metric units To style the table you can use additional CSS definitions like this:
.dwdforecasttable { line-height: 1.0; } .dwdforecasttable td { text-align: center; padding-left: 3px; padding-right: 3px; line-height: 1.2; } .dwdforecasttable .icons td { padding-top: 5px; padding-bottom: 0px; } .dwdforecasttable .topdist td { padding-top: 5px; } .light .dwdforecasttable td.weekend { background-color: #ffe; } .dark .dwdforecasttable td.weekend { background-color: #333; } /* scrollbar for 48-hour hourly forecast */ .dwdforecast-horizontal.dwdforecast-hourly48 { /* prevent vertical scrollbar */ padding: 5px; /* switch on horizontal scrollbar */ overflow-x: scroll; }
If there is a
custom.css
file, put them there. Otherwise look for the place where your skin wants them to be. -
diagrams and self-designed layouts:
Configure a binding and use it like every binding.
[DataBindings] ... [[openmeteo_binding]] database = openmeteo_sqlite table_name = forecast manager = weewx.manager.Manager schema = schemas.dwd.schema ... [Databases] ... [[openmeteo_sqlite]] database_name = "dwd-forecast-openmeteo-LATITUDE-LONGITUDE-LIST_OF_MODELS.sdb" database_type = SQLite ...
As you can retrieve data of several weather models at once, the observation types include the model name. To see how they are called, open the
*.sdb
file usingsqlite3
and enter.schema
. This will present a list of all observation types available.Example configuration for Belchertown skin within
graphs.conf
:[[forecast]] tooltip_date_format = "dddd LLL" gapsize = 3600 # 1 hour in seconds credits = "© OpenWeather" data_binding = openmeteo_binding time_length = all [[[outTemp]]] [[[dewpoint]]]
Example configuration within
skin.conf
:[ImageGenerator] ... [[day_images]] ... [[[forecast]]] data_binding = openmeteo_binding line_gap_fraction = 0.04 time_length = 950400 x_label_format = %d.%m. [[[[outTemp]]]] [[[[dewpoint]]]]
Open-Meteo provides forecasts from several different weather services from around the world. Some of those weather services provide more than one weather model. To select the weather service and weather model to use set the key model
or the the option --open-meteo
, respectively, as follows:
--open-meteo= / model= | Country | Weather service | Model |
---|---|---|---|
dwd-icon | DE | DWD | ICON |
gfs | US | NOAA | GFS |
meteofrance | FR | MeteoFrance | Arpege+Arome |
ecmwf | EU | ECMWF | open IFS |
jma | JP | JMA | GSM+MSM |
metno | NO | MET Norway | Nordic |
gem | CA | MSC-CMC | GEM+HRDPS |
ecmwf_ifs04 | EU | ECMWF | IFS |
metno_nordic | NO | MET Norway | Nordic |
icon_seamless | DE | DWD | ICON Seamless |
icon_global | DE | DWD | ICON Global |
icon_eu | DE | DWD | ICON EU |
icon_d2 | DE | DWD | ICON D2 |
gfs_seamless | US | NOAA | GFS Seamless |
gfs_global | US | NOAA | GFS Global |
gfs_hrrr | US | NOAA | GFS HRRR |
gem_seamless | CA | MSC-CMC | GEM |
gem_global | CA | MSC-CMC | GEM |
gem_regional | CA | MSC-CMC | GEM |
gem_hrdps_continental | CA | MSC-CMC | GEM-HRDPS |
ukmo_seamless | GB | UK Met Office | UKMO Seamless |