Skip to content

Commit

Permalink
feat: add get_air_pollution function to airpyllution.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danfke committed Jan 14, 2022
1 parent 7619c67 commit 80505e2
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/AirPyllution/airpyllution.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,29 @@ def get_pollution_history(start_date, end_date, lat, lon, api_key):
0 1606482000 270.367 5.867 43.184 4.783 14.544 13.448 15.524 0.289
1 1606478400 280.38 8.605 42.155 2.459 14.901 15.103 17.249 0.162
2 1606474800 293.732 13.523 41.47 1.173 15.14 17.727 19.929 0.072
"""
"""

def get_air_pollution(lat, lon, api_key):
"""Returns a map depicting varying pollution levels for a specified location.
The function makes an API request to the OpenWeather Air Pollution API and fetches
pollution data for a given location.
The function transforms the returned JSON object from the request into an altair chart.
Parameters
----------
lat : float
geographical latitude coordinate for the location
lon : float
geographical longitude coordinate for the location
api_key: string
OpenWeather API key
Returns
-------
altair.Chart
Examples
--------
>>> get_air_pollution(49.2497, -123.1193, "APIKEY_example")
"""

0 comments on commit 80505e2

Please sign in to comment.