Question: Write a function to access a file of earthquake data and create a list of the magnitudes of the earthquakes in the file, then another

Write a function to access a file of earthquake data and create a list of the magnitudes of the earthquakes in the file, then another function to analyze the magnitudes data. Finally, you will write a function to report the count, mean, median, mode, and frequency occurrences of the earthquake magnitudes. Write three new functions: equake_readf, equake_analysis, and equake_report. Function equake_readf will have one parameter, fname, a string, which is the name of the earthquake file. equake_readf should open file fname and create and return a list of the earthquake magnitudes from this file Function equake analysis will have one parameter, magnitudes, the list of earthquake magnitudes (the list returned by equake_readf). equake_analysis will call functions from the data analysis file (project 6-2) to determine the mean, median, and mode of the data in the magnitudes list, and then return this result as a tuple Function equake_report will have two parameters, mmm (the tuple returned by equake analysis) and magnitudes (the list returned by equake readf), and return None. It will report the number (count) of earthquakes, and the mean, median, and mode of magnitudes. It will also call frequencyTable to report the number of occurrences of each item in magnitudes. When you have written and tested these, write function main to call functions equake readf, equake analysis, and equake report. main returns None main should look similar to this def main): )-> None Calls: equake_readf, equake_analysis, equake_report Top level function for earthquake data analysis. Returns None. #fname- equakes 50 f . txt fname = equakes25f.txt #fname = equakes. Short. txt emags = eguake-readf(fname) mmm = equake-analysis (emags) equake_report (emags, mmm) return None

The text files are

equakes50f.txt:

time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource 2010-07-28T16:12:05.610Z,43.756,-125.815,10,5.2,mwc,193,143.9,,0.93,us,usp000hh0t,2017-08-01T16:34:36.951Z,"off the coast of Oregon",earthquake,,,,,reviewed,us,gcmt 1993-12-04T22:15:19.720Z,42.2915,-122.0086667,4.797,5.1,md,126,113,,0.11,uw,uw10316468,2017-04-13T22:06:07.852Z,"Oregon",earthquake,0.468,0.56,0.04,7,reviewed,uw,uw 1993-09-21T05:45:35.230Z,42.3575,-122.0583333,8.53,6,md,234,128,,0.08,uw,uw10313838,2018-02-23T23:02:14.153Z,"Oregon",earthquake,0.4,0.85,0.02,3,reviewed,uw,uw 1993-09-21T03:28:55.630Z,42.3161667,-122.0266667,8.56,5.9,md,201,129,,0.09,uw,uw10313718,2018-01-16T17:56:02.876Z,"Oregon",earthquake,0.441,0.93,0.02,3,reviewed,uw,uw 1993-03-25T13:34:35.440Z,45.0351667,-122.6065,19.608,5.6,md,40,67,0.2067,0.39,uw,uw10306313,2017-05-10T20:02:37.829Z,"Oregon",earthquake,0.934,2.84,,2,reviewed,uw,uw 1980-05-18T15:32:11.430Z,46.2073333,-122.188,1.51,5.7,md,18,62,0.008296,0.22,uw,uw10084803,2018-01-25T18:47:04.065Z,"Mount St. Helens area, Washington",earthquake,0.682,0.56,0.08,1,reviewed,uw,uw 1980-04-22T19:28:18.710Z,46.2026667,-122.182,-0.523,5,md,21,57,0.03886,0.18,uw,uw10084513,2016-07-24T21:26:43.420Z,"Mount St. Helens area, Washington",earthquake,0.439,0.62,0.07,1,reviewed,uw,uw 1980-04-18T21:16:02.120Z,46.208,-122.1825,-0.223,5,md,22,59,0.04013,0.19,uw,uw10082403,2016-07-24T21:26:24.290Z,"Mount St. Helens area, Washington",earthquake,0.46,0.73,0.09,1,reviewed,uw,uw 1980-04-14T13:49:03.760Z,46.2035,-122.1973333,0.515,5.2,md,21,55,0.0289,0.19,uw,uw10080808,2016-07-24T21:26:05.760Z,"Mount St. Helens area, Washington",earthquake,0.042,0.05,0.13,1,reviewed,uw,uw 1980-04-08T19:29:02.910Z,46.2098333,-122.1958333,-0.561,5.1,md,19,63,0.03255,0.39,uw,uw10077923,2016-07-24T21:25:35.450Z,"Mount St. Helens area, Washington",earthquake,1.374,1.85,0.07,1,reviewed,uw,uw 1976-12-19T19:00:59.500Z,42.752,-125.603,15,5.4,mb,,,,,us,usp0000kuc,2014-11-06T23:21:38.664Z,"offshore Oregon",earthquake,,,,,reviewed,us,us 1975-07-29T01:48:16.200Z,43.687,-126.103,33,5.2,mb,,,,,us,usp0000c7e,2014-11-06T23:21:31.509Z,"off the coast of Oregon",earthquake,,,,,reviewed,us,us 1973-06-16T14:43:47.500Z,44.98,-125.774,33,5.6,mb,,,,,us,usp000026k,2015-05-13T18:53:08.000Z,"off the coast of Oregon",earthquake,,,,,reviewed,us,us

equakes25f.txt

time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource 2018-10-01T00:31:15.910Z,42.0223333,-124.2715,16.22,2.99,ml,12,173,0.05672,0.27,uw,uw61424827,2018-10-02T03:31:16.224Z,"3km SSE of Brookings, Oregon",earthquake,1.11,0.96,0.204,10,reviewed,uw,uw 2018-09-25T13:18:50.110Z,45.6766667,-122.8965,22.71,2.56,ml,43,38,0.1266,0.11,uw,uw61422757,2018-10-01T21:06:21.040Z,"8km S of Scappoose, Oregon",earthquake,0.18,0.41,0.101,23,reviewed,uw,uw 2018-09-17T00:08:26.690Z,45.1358333,-122.9721667,40.89,2.83,ml,45,30,0.1447,0.24,uw,uw61419862,2018-10-08T02:55:33.040Z,"6km WNW of Gervais, Oregon",earthquake,0.31,0.38,0.183,25,reviewed,uw,uw 2018-09-08T14:17:50.380Z,42.2935,-124.6693333,21.05,2.76,ml,9,264,0.2409,0.12,uw,uw61426681,2018-10-06T19:01:11.040Z,"23km WSW of Gold Beach, Oregon",earthquake,0.88,0.33,0.265,9,reviewed,uw,uw 2018-08-30T23:38:18.160Z,44.8213333,-122.2221667,3.78,2.57,ml,4,255,1.001,0.08,uw,uw61424371,2018-11-02T14:37:24.040Z,"21km ENE of Mill City, Oregon",earthquake,10.57,31.61,0.376,2,reviewed,uw,uw 2018-08-24T10:48:50.260Z,44.228,-125.4033,10,2.8,ml,,177,1.087,0.96,us,us1000ggsm,2018-11-01T17:50:57.040Z,"107km WNW of Florence, Oregon",earthquake,4.9,2,0.039,86,reviewed,us,us

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!