Note: Please only use python standard libraries covered in class lectures (i.e. json, csv, urllib etc). Other libraries such as pandas, numpy are *not* allowed in your work.  1. This problem involves...

Note: Please only use python standard libraries covered in class lectures (i.e. json, csv, urllib etc). Other libraries such as pandas, numpy are *not* allowed in your work.

1. This problem involves pulling data from public data APIs, deriving results from the data and outputting the computed results as a json file. You will utilize the APIs from MetaWeather (https://www.metaweather.com/api). For details on how to use their APIs to get weather data, please refer to the site’s documentation and the jupyter notebook that was covered in class. Write Python code to perform the following:


i. Pull daily weather data for San Francisco for the month of February (2/1/2020 – 2/29/2020). Filter out all the forecast weather data (i.e. only include data which has the “applicable_date” on the same day as the “created” field). For example, the following shows the partial data (only created, applicable_date and the_temp are shown) for 2/27/2020. Only the rows with “created” on 2020-02-27 should be kept (shown in red) and all the others should be filtered out.


You may notice that the first 3 rows have “created” date as 2/28 with the “applicable_date” of 2/27. The reason is that the datetime string for “created” is in UTC timezone which is 7 hours ahead of Pacific Daylight Time (PDT) and so those 3 rows are still technically data on 2/27 PDT. For simplicity, you don’t have to take this timezone offset into account and only include the rows that fall on the same day as the applicable date.


ii. Compute the maximum, minimum and average temperature for each day in February from the temperatures extracted in previous step. For example, for 2/27,


you will compute the maximum, minimum and average temperature using the 8 temperature values (in the red bold rows above) for that day. iii. Write out the maximum, minimum and average temperatures by day to a json file (temp_stats.json) and it should look like this(again the temperature values shown below are not the true values):


May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here