Week 8 (3/28-4/3)

Notebook

Weekly digest

Project

Data formats

lxml installation

[ ]:
%pip install lxml

Resources

1. Sample Excel file

2. Sample SVG files

Dodecahedron.svg

[12]:
dodeca = "https://upload.wikimedia.org/wikipedia/commons/a/a4/Dodecahedron.svg"

Usa_counties_large.svg

[2]:
counties = "https://upload.wikimedia.org/wikipedia/commons/5/59/Usa_counties_large.svg"

3. National Weather Service API

Documentation

  • Alerts url:

[8]:
alerts_url = "https://api.weather.gov/alerts"
  • Point url:

[9]:
point_url = "https://api.weather.gov/points/"

4. Nominatim API

Documentation

[10]:
nominatim_url = "https://nominatim.openstreetmap.org/search"

Exercise

Use Nominatim API and National Weather Service API to write a function get_forecast() that prints weather forecast for a given city in the United States.

Example.

[2]:
get_forecast("Buffalo, NY")
Buffalo, Erie County, New York, United States

Today
Temperature: 38 F
Wind: 16 to 22 mph SW
Forecast: A chance of rain showers before 4pm, then rain and snow.
Cloudy, with a high near 38. Southwest wind 16 to 22 mph. Chance of
precipitation is 80%. New rainfall amounts less than a tenth of an
inch possible.

Tonight
Temperature: 27 F
Wind: 21 mph W
Forecast: Rain and snow before 2am, then snow and areas of blowing
snow. Cloudy, with a low around 27. West wind around 21 mph. Chance of
precipitation is 100%. New snow accumulation of 1 to 2 inches
possible.

Sunday
Temperature: 30 F
Wind: 17 to 21 mph W
Forecast: Snow and areas of blowing snow before 4pm, then a chance of
snow showers. Cloudy, with a high near 30. West wind 17 to 21 mph,
with gusts as high as 31 mph. Chance of precipitation is 90%. New snow
accumulation of 1 to 2 inches possible.

Sunday Night
Temperature: 16 F
Wind: 15 to 20 mph NW
Forecast: A chance of snow showers. Mostly cloudy, with a low around
16. Northwest wind 15 to 20 mph, with gusts as high as 31 mph. Chance
of precipitation is 40%. New snow accumulation of less than half an
inch possible.

Monday
Temperature: 28 F
Wind: 17 mph NW
Forecast: A chance of snow showers. Mostly cloudy, with a high near
28. Northwest wind around 17 mph, with gusts as high as 28 mph. Chance
of precipitation is 30%. New snow accumulation of less than half an
inch possible.

Monday Night
Temperature: 16 F
Wind: 8 to 17 mph NW
Forecast: A chance of snow showers before 11pm. Mostly cloudy, with a
low around 16. Chance of precipitation is 30%. Little or no snow
accumulation expected.

Tuesday
Temperature: 36 F
Wind: 6 to 9 mph NW
Forecast: Mostly sunny, with a high near 36.

Tuesday Night
Temperature: 22 F
Wind: 5 to 8 mph S
Forecast: A slight chance of snow showers after 2am. Mostly cloudy,
with a low around 22.

Wednesday
Temperature: 43 F
Wind: 10 mph E
Forecast: A chance of snow showers before 1pm, then rain showers
likely. Mostly cloudy, with a high near 43. Chance of precipitation is
60%.

Wednesday Night
Temperature: 37 F
Wind: 10 mph SE
Forecast: Rain showers likely. Cloudy, with a low around 37. Chance of
precipitation is 60%.

Thursday
Temperature: 62 F
Wind: 10 to 14 mph S
Forecast: Rain showers likely. Mostly cloudy, with a high near 62.
Chance of precipitation is 70%.

Thursday Night
Temperature: 36 F
Wind: 14 mph SW
Forecast: Rain showers likely. Mostly cloudy, with a low around 36.
Chance of precipitation is 70%.

Friday
Temperature: 44 F
Wind: 13 to 20 mph SW
Forecast: A chance of rain showers. Partly sunny, with a high near 44.
Chance of precipitation is 40%.

Friday Night
Temperature: 31 F
Wind: 10 to 18 mph W
Forecast: A chance of rain showers before 7pm, then a chance of rain
and snow showers. Mostly cloudy, with a low around 31. Chance of
precipitation is 30%.