csparpa / pyowm

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

airpollutionapi30 has incorrectly swapped latitude and longitude #387

Closed davidpirogov closed 2 years ago

davidpirogov commented 2 years ago

Fairly straightforward bug that fails in locations greater than plus-minus 90 degrees longitudinal, such as Melbourne, Australia (place id 2158177, 'lon': 144.9633, 'lat': -37.814)

The offending code is in the lines below: https://github.com/csparpa/pyowm/blob/0474b61cc67fa3c95f9e572b96d3248031828fce/pyowm/airpollutionapi30/airstatus.py#L91-L92

Simple fix to swap the dictionary keys so that the lat variable refers to float(the_dict['coord']['lat']) and that the lon variable refers to float(the_dict['coord']['lon'])

csparpa commented 2 years ago

Haaaa good catch! A classic human error ;-)

@davidpirogov would you feel like directly proposing a pull request for this? If so, please also include a unit-test to "fix the fix"

Thanks!!

davidpirogov commented 2 years ago

@csparpa done!

csparpa commented 2 years ago

Closed with #390