Python assignment

User Generated

Xngvr0199

Computer Science

Description

I uploaded for you everything you need.

Let know if you have any question.

Unformatted Attachment Preview

EGEN 102 Introduction to Engineering Computations and Applications Spring 2019 Homework #8 Due Tuesday, March 26, 2019 at 12:00pm to Brightspace Assignment Folder You have been hired by MSU to analyze annual snowfall in the winter of 2019 relative to the average winter over the past 50 years. The data set LickCreek2019.csv has been provided to you. This is actual snow accumulation data (in inches) measured at the nearest weather station, Lick Creek, in Hyalite canyon. (The data was downloaded from the National Resource Conservation SNOTEL website on March 12, 2019, https://www.wcc.nrcs.usda.gov/snow/snow_map.html). The data set has three columns: Day, where day zero is Nov. 1 of each winter, Current, which is the 2019 snow accumulation at the weather station in inches; and Median, which is the average snow accumulation on the same day over the past 50 years. The first part of your job is to plot the current snow accumulation for 2019 and the median snow accumulation versus the day of the winter on the x-axis. The second part of your job is to report the slope of a regression line for the data (accumulation on the y-axis versus day on the x-axis) for the current year and the 50-year median. The slope represents the average accumulation per day. How does 2019 accumulation compare to the median? Include your computer code in the appendix. Day,Current,Median 0,0,0 1,3,0.5 2,3,1.5 3,2,2 4,4,4 5,4,3.5 6,4,4 7,9,3.5 8,7,3.5 9,6,3 10,6,3 11,7,5 12,7,5 13,6,4.5 14,6,5 15,7,4.5 16,10,5 17,10,4.5 18,9,5 19,8,6.5 20,9,9 21,9,9 22,9,8 23,9,7 24,14,7.5 25,14,8 26,13,8 27,13,8.5 28,12,8 29,12,8.5 30,14,8.5 31,14,11 32,14,11.5 33,14,12 34,14,12 35,13,11.5 36,12,11 37,14,11 38,13,13 39,14,13.5 40,18,14 41,16,13.5 42,16,13.5 43,16,13.5 44,16,14.5 45,15,14 46,15,14.5 47,15,14.5 48,15,14.5 49,15,15.5 50,15,15 51,16,16 52,16,16 53,16,16.5 54,16,17 55,16,18 56,18,18 57,18,18 58,18,19 59,19,19.5 60,28,21 61,25,20 62,23,19.5 63,23,19 64,22,20 65,22,21 66,22,21.5 67,21,21.5 68,21,21.5 69,21,21 70,21,21 71,20,21 72,20,22 73,20,21 74,20,21.5 75,20,22 76,20,21 77,20,21 78,20,21 79,20,21.5 80,20,22 81,21,22 82,22,23 83,28,23 84,36,23.5 85,36,24.5 86,33,23 87,31,24.5 88,31,23 89,32,23 90,32,24 91,33,26 92,34,27 93,33,26 94,32,25.5 95,30,26.5 96,30,26 97,34,25.5 98,34,25 99,33,26.5 100,32,26 101,32,26 102,32,26 103,32,27 104,30,28.5 105,31,29 106,32,30.5 107,32,30 108,32,32 109,33,32 110,33,33 111,33,33 112,33,34 113,34,32.5 114,34,31.5 115,34,32 116,35,32 117,37,32.5 118,45,34.5 119,43,33.5 120,46,32.5 121,45,33.5 122,44,33 123,43,34 124,42,36 125,41,36.5 126,40,35.5 127,42,33 128,44,35.5 129,42,34.5 130,42,35 131,41,34.5
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

The final submission. To run the code please use the codes word doc and change the file path for your file. Please change the same in the appendix A of the Final solution as well.

Snowfall Problem
In the given csv (lickcreek) there are three columns.
o Day – The days of a winter starting from November 1. November 1 is taken as day 0.
o Current – The snow accumulated this year till the corresponding day at the weather
station. The snow accumulated is measured in inches.
o Median – The average snow accumulated for last 50 years in the same weather
station.

Pre-Work
We have read the csv files into a pandas data-frame and used the columns of that dataframe everywhere. This is done through the loadCSVtoDF() function (Appendix A). This
function reads the csv file kept in a given location

Part I
Plotting Accumulated snowfall against day
Using the pandas data-frame we have plotted both the current year accumulation and
median accumulation against the day.
Hence, the delta accumulation for each day for both the plots give the snowfall
accumulation increase (or decrease) on that day.
Fitting, those two plots give the following figure (Figure 1).
The code used for this is present in the function plotDayvsSnowFalls(df), (Appendix A)
which uses the data-frame already crated and plots the two snowfalls.

Part II
Plotting Regression Line and
Using the pandas data-frame we have plotted both the current year accumulation and
median accumulation against the day.
Now using the
Fitting, those two plots give the following figure (Figure 2).
The code used for this is present in the function plotRegressions(df), (Appendix B) which
uses the data-frame already crated and plots the two snowfalls.

Conclusion
Comparative study of the regression lines
After this we retrieve the slope using the list which has been returned by Part II and
compare them using the python code (Appendix C).
We see that the current year has a higher slope as suggested by the figure. The difference
of the slopes is 0.036 inches / day. (Median slope = 0.262 inches / day and current year
slope = 0.298 inches / day).
Hence, it can be concluded that there is about 13.9% hi...


Anonymous
Just what I needed…Fantastic!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags