Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python pls Both the National Aeronautic and Space Administration (NASA) and the National Oceanic and Atmospheric Administration (NOAA) are excellent sources for free and

in python pls image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Both the National Aeronautic and Space Administration (NASA) and the National Oceanic and Atmospheric Administration (NOAA) are excellent sources for free and accurate environmental arid temperature data. The Global_Temperature_Data_File.txt (you can download this below) is the global temperature anomaly data available through NASA's website and has not been modified for this assignment. This data represents "the change in global surface temperature relative to 1951-1980 average temperatures" and includes both land and ocean temperatures. The file is TAB delimited, and has several columns - The first column is the year of the temperature reading - The middle column represents the anomaly in the land temperatures for that year. - The last column represents the anomaly in the ocean temperatures for that year. You are asked to compute the average of both land temperature and ocean temperature based on given data (we provided a sample output below for reference) You will also need to ute additional functions (such as split)) in order to access the different values in the row (remember you can use it as a separator to split strings based on tabs, which is how the data in this file is separated). For example, to read the lines in file we would open the file and read lines, and then loop through each line and split by separator, which is a 'it meaning a tab. Your job is to complete this code to compute the average land temperature and average ocean temperature. Note, to compute the average of land temperature for example, you should compute the sum of ail land temperature values and then divide by the number of reading5. which is given by variable numReadings. Once you have calculated the average temperatures, you will need to calculate the variance of the values in the file for each column. The most useful equation for finding variance is below. When you calculate variance, print it out in addition to the values above with the following text. Note, you may need 1 loop to compute the average, then a second loop to compute the variance. S2=n1(xix)2 S2= sample variance xi= the value of the one observation x= the mean value of all observations n= the number of observations main.py Load default ten 1 with open("Global Temperature_Data File,txt" " " rn ) as filetlandle \#t open file 2 lines - fileHiandle. readlines O * read all lines into variable 3 4 numReadings - len(lines) \# number of temperature readings - number of lines in the file \#1 next, loop through each line in the file and split line by separotor 7 8 avgoceantemp =0 9 avgland Temp - 10 for line in lines: year, land Temp, oceantemp = line, split(")t") : rooo - convert landemp and oceantemp to floats and compute averages 4 T000 - write code to compute averoge of land temp and ocean temp and print results main.py Load defalt template... 14 \# ToDo - write code to compute average of larid temp and ocean temp and print results 15 16 print ("Average land temperature anomaly: ", avgLandTemp) 17 print ("Average ocean temperature anomaly: ", avgoceanTemp ) 18 19 landVariance =0 20 oceanVariance =0 21 for line in lines: 22 year, landTemp, oceanTemp = line.split(" \t ) 23 \# TOO0 - write code to compute average of variance. 25 * To00 - print the variance of land temp and ocean temp 26 print ("Land temperature anomaty variance: ", landvariance) 27 print ("Ocean temperature anomaly variance: ", oceanVariance) Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box Enter program input (optional) 1880=0.19=0.111881=0.10.141882=0.10.171883=0.190.211884=0.28=0.241885=0.31=0.2618860.320.271887=0.35=0.271888=0.18=0.271889=0.110.261890=0.37=0.261891=0.24=0.271892=0.27=0.271893=0.320.271894=0.320.241895=0.22=0.231896=0.11=0.211897=0.12=0.1918980.28=0.171899=0.18=0.181900=0.09=0.211901=0.15=0.241902=0.30.271903=0.39=0.31904=0.49=0.321905=0.28=0.351906=0.23=0.371907=0.4=0.381908=0.44=0.41909=0.48=0.411910=0.44=0.411911=0.43=0.391912=0.36=0.351913=0.35=0.321914=0.16=0.31915=0.12=0.291916=0.33=0.281917=0.430.281918=0.28=0.2819190.27=0.281920=0.25=0.261921=0.17=0.25 4319220.270.2419238.240.2219240.25=0.2119250.210.211926=0.09=0.219270.20.219280.190.1919290.350.181930=0.150.1919310.10.1919320.170.181933=0.3=0.181934=0.14=0.171935=0.210.1519360.160.121937=0.04=0.081938=0.03=0.031939=0.03=0.0119400.11=0.0519410.180.081942=0.05=0.0919430.07=0.0919440.210.0719450.090.0319460.07=019470.040.0419480.110.0719490.110.0919500.19=0.081951=0.07=0.081952=0.010.081953=0.070.081954=0.150.071955=0.140.061956=0.2=0.051957=0.04=0.041958=0.070.011959=0.03=0.021962=0.04=01963=0.07=0.02851964=0.2=0.03 861965=0.10.041966=0.05=0.051967=0.020.041968=0.07=0.031969=0.07=0.011970=0.03=01971=0.09=01972=0.0101973=0.16=0.011974=0.08=01975=0.02=0.0119760.110.031977=0.17=0.071978=0.06=0.121979=0.16=0.161980=0.27=0.1919810.33=0.211982=0.130.221983=0.31=0.21198419850.160.120.210.231986=0.18=0.2519870.330.28198819890.410.280.310.34110111198919900.280.440.340.3411219910.410.3311319920.220.3311419930.240.3311519940.310.3411619950.440.37117118199619970.330.470.40.431191998=0.620.451201999=0.4=0.481212000=0.4=0.51222001=0.54=0.5212320020.62=0.55124125200320040.610.53=0.580.61262065=0.67=0.611272006=0.62=0.61 1001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620170.160.270.330.130.310.160.120.180.330.410.280.440.410.220.240.310.440.330.470.620.40.480.4=0.50.540.620.610.530.670.620.640.520.630.70.570.610.640.730.860.990.90.950.160.190.210.220.210.210.230.250.280.310.340.340.330.330.330.340.370.40.430.450.520.550.580.60.610.610.610.620.620.620.630.670.710.770.830.89

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is a reporter gene? Describe two widely used reporter genes.

Answered: 1 week ago

Question

calculate the heat of combustion of methanol

Answered: 1 week ago