Assignment #06

Unit 06

Until next week, work through the material provided in Unit 6 and solve the following exercises in a notebook.

#06-01: Use datetime provided in WX
  • Load WX_GNP.csv, the same data set we used in last unit’s assignment.
  • How many records are available from 2019?
  • Create a new data frame WX19 that contains all records from the 2018/19 winter season. Let’s take all records between September and Mai. The only meteorological variables we need in addition to the meta variables station_id and datetime are ta and iswr.
  • Save WX19 as a new csv file.
Tip

Make sure you use an elegant pythonic approach to solve these datetime tasks, like demonstrated in Pandas: Index & datetime.

#06-02: Quick ’n dirty time series
  1. From WX19, create a new data frame WXzoom1 that contains the records from the first two weeks of January and any station_id of your choice.
  2. Using the WXzoom1 data frame, plot a line graph of the temperature that also shows the measurements with circles and, in a different figure, plot an area curve of the incoming shortwave radiation.
Tip

If your x-axis shows integers instead of dates and times, compare WXzoom1 before and after running the following line of code: WXzoom1.set_index('datetime', inplace=True). What changed? Run your plot command again. Do you now see a proper time series representation with time on the x-axis?

#06-03: Summary stats
  1. From WX19, create a new data frame WXzoom2 that contains the records from the first two weeks of January and the first two station_id’s in WX19['station_id'].unique().
  2. Using the WXzoom2 data frame, what is the average temperature of each of the stations?
  3. Using the WXzoom2 data frame, plot the temperature curves of both stations into one figure.
  1. Remember the pandas method .isin() to filter for the station_ids.
  2. Go back to the Pandas tutorials we worked through in Unit #5, if you’re struggling.
  3. Create a figure and axes using plt.subplots() and then step-by-step fill the axes with the two lines one after another by subsetting WXzoom2 to the individual station_id’s.