Question
Write a Python program to do the followings: (1) Read the file and find top 10 worst earthquakes and save them to top10-worst.txt file. Note
Write a Python program to do the followings:
(1) Read the file and find top 10 worst earthquakes and save them to top10-worst.txt file.
Note the larger the magnitude, the worse the earthquake.
(2) For the top 10 worst earthquakes, find the distance to TSU, and save the result to dist-toTSU.txt.
Hint: (i) TSUs latitude and longitude are 36.16963449238665, -86.82562299320742
(Unit: degree).
(ii) The distance between two points can be calculate by
= (sin(1) sin(2) + cos(1) cos(2) cos (2 1))
6371
lat1, lon1 are the latitude and longitude of point 1, and lat2 and lon2
are the latitude and longitude of point 2, respectively.
The parameter for sin and cos function in Python is radian. 1 radian
equals to 57.296.
6371 is Earth radius in km.
Provide source code
Insert the screenshot of your source code.
Insert the screenshot of the result
The file is below:
Date | Time | Latitude | Longitude | Depth | Magnitude |
1/2/1965 | 13:44:18 | 19.246 | 145.616 | 131.6 | 6 |
1/4/1965 | 11:29:49 | 1.863 | 127.352 | 80 | 5.8 |
1/5/1965 | 18:05:58 | -20.579 | -173.972 | 20 | 6.2 |
1/8/1965 | 18:49:43 | -59.076 | -23.557 | 15 | 5.8 |
1/9/1965 | 13:32:50 | 11.938 | 126.427 | 15 | 5.8 |
######## | 13:36:32 | -13.405 | 166.629 | 35 | 6.7 |
######## | 13:32:25 | 27.357 | 87.867 | 20 | 5.9 |
######## | 23:17:42 | -13.309 | 166.212 | 35 | 6 |
######## | 11:32:37 | -56.452 | -27.043 | 95 | 6 |
######## | 10:43:17 | -24.563 | 178.487 | 565 | 5.8 |
######## | 20:57:41 | -6.807 | 108.988 | 227.9 | 5.9 |
######## | 0:11:17 | -2.608 | 125.952 | 20 | 8.2 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started