Closed robinmetral closed 2 years ago
Heyho @robinmetral, thanks for the kind words and for reaching out! :)
Bright Sky stores four different types of weather records, which correspond to different datasets on the DWD server:
historical
- hourly real observations up to yesterdaycurrent
- hourly real observations from todaysynop
- sub-hourly, very recent observations (usually between 10 and 90 minutes old)forecast
- hourly forecasts between today and ten days aheadUnfortunately the stations outside of Germany show up almost exclusively in the MOSMIX dataset on DWD server, i.e. only in forecasts. Hence why you only see a single source with observation type forecast
in your query to /sources
. Stations where the DWD supplies real measurements usually have three or four sources (corresponding to the observation types above), like WMO station 10315.
The /current_weather
endpoint is based on observations of type synop
. So this is why you see your request to /current_weather
failing: there are no observations of type synop
available for this WMO ID, only observations of type forecast
.
(Side note: it's usually nicer to query Bright Sky by latitude and longitude, as it will fill in missing information from nearby stations then.)
That being said, for Prague, the DWD actually does provide real measurements, coming from the airport! You can most easily find this by querying the /sources
endpoint with lat and lon.
Querying https://api.brightsky.dev/weather?lat=50.02&lon=14.45&date=2022-03-14 (caution: you'll have to change the date
every day) will get you the observations of this station, along with forecasts for the timestamps where the real observations are not available yet - notice how the source_id
changes in the middle of the day.
So if you're looking for the current weather in Prague, either the latest observation of type current
or the forecast with the closest timestamp to now could be good candidates to start from. That's as good as you'll get from Bright Sky at this stage. :/
I assume this was not exactly what you were hoping to hear, but I hope it helped a little :)
That's amazing, thanks a lot for the detailed reply @jdemaeyer! Very useful and informative. I'll follow your advice of querying by lat/lon, especially for locations outside of Germany (I'm always tempted to query by station ID to avoid the reverse geocoding work but it makes sense that lat/lon can find the right data is data is scarce).
I'll close this since I got the answer I was looking for—thanks again and take care!
Hi, thanks a lot for this API! I've really liked using it in small projects so far.
I'm aware that it's focusing on German weather stations, but I've been running into issues when trying to get data for known foreign stations.
For example, I can query
/sources
with the Prague WMO station ID (found here), and it works as expected:...but then when attempting to query the current weather using the Prague Bright Sky source ID, I get a 400:
Trying to query the current weather using the WMO ID directly also fails with a 404.
Is this known/expected? I know that foreign weather isn't the intended use case for Bright Sky, but I was still expecting it to work since the station is known by DWD and has a valid Bright Sky ID.
Thanks again and have a great week ahead! ☀️