jdemaeyer / brightsky

JSON API for DWD's open weather data.
https://brightsky.dev/
MIT License
287 stars 18 forks source link

Condition = rain while precipitation = 0 #131

Closed ptoews closed 1 year ago

ptoews commented 1 year ago

I noticed that there are responses where the condition field contains "rain" while the precipitation field is zero. Is this intended? How can this be interpreted? One example (e.g. at 04:00): https://api.brightsky.dev/weather?lat=50.4&lon=6.6&date=2022-09-06

jdemaeyer commented 1 year ago

Hi @ptoews and thanks for the feedback!

Bright Sky is mostly just an easier-to-use gateway to data from the DWD's open data server, so we return the precipitation and condition fields unfiltered as they show up there. In this case, the corresponding file for historical precipitation at station 902 (Dahlem-Schmidtheim) contains the following line for the weather record you mention:

        902;2022090604;    1;   0.0;   1;-999;eor

where the 0.0 indicates 0 millimeters of rain, and the 1 that follows it indicates "precipitation has fallen" (slightly more details here).

So, to sum this boring detail up into an answer to your first question: yes, this is intended -- in the sense that Bright Sky correctly returned the corresponding DWD data for your query. ;)

Moving to the second and probably more relevant question of how to interpret that combination, I am unfortunately no expert on how exactly the DWD measures these values. My interpretation would be that a little rain has fallen, but it was less than 0.05 mm and so got rounded down to 0.0.

If you want a more human instead of technical indicator of the general weather condition, take a look at the icon field (showing clear-night for the timestamp you mention). That field is not taken from any raw DWD measurements but instead calculated from the other fields by some heuristics built into Bright Sky, including a filter considers anything less than 0.5 mm of rain to be "dry".

I'm closing this issue for now, but feel free to re-open if you think that's necessary. :)

ptoews commented 1 year ago

@jdemaeyer Thanks for the detailed explanation, that sounds reasonable