PLease help meeeee Here is sea ice text *SEA ICE FILE: https://www.cse.unsw.edu.au/~en1811/22T2/labs/lab07/sea_ice.txt A

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

PLease help meeeee Here is sea ice text *SEA ICE FILE: https://www.cse.unsw.edu.au/~en1811/22T2/labs/lab07/sea_ice.txt A

Post by answerhappygod »

PLease help meeeee
Here is sea ice text
*SEA ICE FILE:https://www.cse.unsw.edu.au/~en1811/22T ... ea_ice.txt
Please Help Meeeee Here Is Sea Ice Text Sea Ice File Https Www Cse Unsw Edu Au En1811 22t2 Labs Lab07 Sea Ice Txt A 1
Please Help Meeeee Here Is Sea Ice Text Sea Ice File Https Www Cse Unsw Edu Au En1811 22t2 Labs Lab07 Sea Ice Txt A 1 (332.52 KiB) Viewed 56 times
Please Help Meeeee Here Is Sea Ice Text Sea Ice File Https Www Cse Unsw Edu Au En1811 22t2 Labs Lab07 Sea Ice Txt A 2
Please Help Meeeee Here Is Sea Ice Text Sea Ice File Https Www Cse Unsw Edu Au En1811 22t2 Labs Lab07 Sea Ice Txt A 2 (412.69 KiB) Viewed 56 times
Please Help Meeeee Here Is Sea Ice Text Sea Ice File Https Www Cse Unsw Edu Au En1811 22t2 Labs Lab07 Sea Ice Txt A 3
Please Help Meeeee Here Is Sea Ice Text Sea Ice File Https Www Cse Unsw Edu Au En1811 22t2 Labs Lab07 Sea Ice Txt A 3 (451.18 KiB) Viewed 56 times
Answers for checking:
1. avg_sea_ice_annual should be a vector with 35 elements. Thefirst and last are, respectively, 12.3537 and 10.9340.
2. The answer should be a vector with 24 elements. The first andlast are, respectively, 13.7589 and 12.8673.
3. 11.5863
4. It Should have 35 answers. The first five are 14, 14, 14, 15,and 15. The last ten are 13 and followed by nine 12's.
5. 14
6. 10
7. There are 10 values. The first five are [2012, 2007, 2011,2010, 2006...]
8. The answer should be an array whose shape is (35,12) or 35rows and 12 columns. The [0,0] element should be 15.222785; this isthe average of data_sea_ice[0,0] and data_sea_ice[0,1]. The[0,1] element should be 16.03922; this is the average ofdata_sea_ice[0,2] and data_sea_ice[0,3].
Part B: Data analysis using numpy Among the many data sets used in climate change research, the Sea lce Index, or the area covered by sea ice in the northern hemisphere shows particularly marked changes. There are seasonal variations across each year, and trends that span a number of years. The file sea ice.txt, (You can download this file by right clicking on the link, and choose "Download Linked File") contains northern hemisphere total sea ice data, in units of millions of square km, between 1979 and 2013 (i.e., 35 years in total). There are 24 measurements per year, measured once every haif a month. The data in sea ice.tat has 35 rows (one row per year) and 25 columns where the first column contains the year in which the measurements in that row were taken; the half-monthly measurements are stored from the second to the last column. After you have downloaded the file sea_ice.txt, you need to make sure that it is in the directory that you had created earlier. You will need to do a number of pre-processing steps to get the data ready. The steps are shown in the box below with yellow background. One of the first step of data analysis is always to plot the data, so you will do that. You are asked to run these lines one by one and observe the results. The comments will also help you to understand what those commands are doing.
import matplotlib.pyplot as plt * Load data and store it as a numpy array called data_sea_ice data_sea_ice = np.loadtxt(fname="sea_ice.txt") # Check the dimension of the numpy array print("The dimension of the numpy array is: ", data_sea_ice.shape) # The dimension of the array is 35×25 # number of rows = number of years # Each row has 25 elements: * The first element is the year, followed by 24 measurements per year (i.e. 1 measurement per half a month) If Print out the first row to confirm the data format print("The first row of data is \n′′, data_sea_ice[0,:]) A We need to move the years into a different variable and then remove the years from the first column years = data_sea_ice[i,0]; # first column, easy data_sea_ice = np.delete(data_sea_ice, 0 , axis=1) # remove the first column print("The shape of the numpy array is: ", data_sea_ice.shape) # should be 35 (years) ×24 (half-monthly samples) # The following line uses a numpy function to produce the array: array([0.5, 1, 1.5, 2, .. 11.5, 12]) months = np.linspace(0.5,12,24) II We haven't discuss linspace yet but for this lab, it is sufficient for you to know what the contents of the numpy array months are A If you want to know more about the numpy function linspace, its manual page is at il https//docs.scipy.org/docinumpy-1.13.0/reference/generated/numpy.linspace.htmisnumpy.linspace 17 plot the data - you should add the xlabel, ylabel, title y You will see 35 curves, each curve depicts the variation of sea ice extents in one year W The seasonal variation should be obvious and don't forget, the data came from the northem hemisphere N You will need to plot more figures later on, so put it in Figure 1 plt.figure(1) plt.plot(months, np.transpose(data_sea_ice)) pit.xticksu(2, 4,6,8,10,12), ["Feb", "Apr", "Jun", "Aug", "Oct", "Dec"]) W This shows you how to use xticks
# The seasond variation should be obvious and don't forget, the data came from the northern hemisphere # You will need to plot more figures later on, so put it in Figure 1 plt.figure(1) plt.plotimonths, np.transpose(data_sea_ice)) plit.xticks([2,4,6,8,10, 12], ["Feb", "Apr", "]un", "Aug", "Oct", "Dec"]) # This shows you how to use xticks plt.show0) The following is a number of questions on the data set which you should answer using numpy. You should not use any loops. Most questions can be answered with just one line of Python code. There is no restriction that you must use as few lines of code as possible. You can break the steps up into multiple lines of code if you want, especially for Questions 7 and 8 which have several steps. There is only one restriction: no loops. You should copy your Python code to a script so that you can show your tutor later on. Another reason is that we will work on this data set in a later lab. If you want to check your answers, some of them are on this.aage. 1. Determine the annual average sea ice extent, i.e. for each year, compute the average of all the half-monthly measurements over that year. Store the answer in the variable avg sea ise amnual. You should plot the annual average sea ice extent in Figure 2 to have a look. 2. Determine the average sea ice extent for each half-month, i.e. average over the years for each half-month. 3. Determine the average sea ice extent over the entire data collection. Store the answer in the variable avg sea ice which you will need later. 4. For each year, determine the number of half-months that exceeds the overall average calculated in Question 3. 5. Determine the number of years whose annual average is less than the overall average calculated in Question 3. 6. Determine the number of years, within the last 10 years of data, whose annual average is less than the overall average calculated in Question 3. (Note: Questions 5 and 6 together tell you something important about the status of ice extents.) Hint: You have learnt about list slicing in Week 4. You can siice a numpy array in the same way. This question requires you to slice an array from the end of the array, not the beginning. Check the week 4 lecture where we covered this if you need a refresher 7. Determine the 10 years that have the lowest 10 annual average sea ice extents. You should arrange the 10 years such that their corresponding annual averages are sorted in ascending order. That is, the first year in the list is the year that has the lowest annual average sea ice extent, the second year has the second lowest annual average and so on. Hint: Use the numpyargwarc) function (link to the argsortinmanual nase) to get a list of sorted indexes. Think about what you want to sort by (one of the variables you made earlier in the problem), use argsart) on it and then use those indexes on the array yeans. If you're confused check out the first example on the argset) page and understand what it's doing (the other examples are a bit more complicated). 8. The 2-dimensional array data_wea ice contains half-monthly data, but you want to work with monthly data. You want to obtain a 2-dimensional array wea ise monthly which contains monthly data. The matrix should have 35 rows and 12 columns. Column 1 contains the average of the two measurements in January, Column 2 for February, etc. The problem is to compute sea ice menthly from data sea ice without using any loops. You may find the reshape function useful. If you want some hints, click here.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply