csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
789 stars 171 forks source link

Add a workaround for minutely precipitation #344

Closed Tobiaqs closed 3 years ago

Tobiaqs commented 3 years ago

This PR adds a workaround that stores precipitation data from minutely forecast. A onecall JSON response that contains a minutely array uses the precipitation key instead of rain (to save on data) looks like this:

{
  "minutely": [{ "precipitation": 0.443, "dt": 1601552873 }, ...],
  ...
}

This solution takes the precipitation field and copies it to the rain field if rain wasn't already set. The result is that the precipitation data ends up in the rain field encapsulated in a dict like: { 'all': <precipitation_value> }.

Fixes #343