#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ENGG1811 Lab Data analysis on sea ice (Part 2) """ # %% Import packages import numpy as np import matplotlib.pyplot as plt # %% Preliminary processing # Load data and store it as a numpy array called data_sea_ice data_sea_ice = np.loadtxt('sea_ice.txt') # Extract information on year from data_sea_ice years = data_sea_ice[:,0]; # first column years = years.astype(int) # change data type to int data_sea_ice = np.delete(data_sea_ice,0,axis=1) # remove the first column # Array on months months = np.linspace(0.5,12,24) # The sea ice data began in year 1979 and lasted until 2013 (35 years) # There are 24 half-monthly measurements per year # years is the numpy array [1979, 1980, ..., 2013] # months is the numpy array [0.5, 1, 1.5, ..., 12] # data_sea_ice is a numpy array of shape (35,24) containing # sea ice extent # plot the data plt.figure(1) plt.plot(months,np.transpose(data_sea_ice)) plt.xlabel("Months") plt.xticks([2,4,6,8,10,12],["Feb","Apr","Jun","Aug","Oct","Dec"]) plt.ylabel("Sea ice extent") plt.grid() plt.show() # %% **************************** # Please insert your code below