Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this file you will fill in the code to use the turtle module to create an animation of hurricane Irma's path. In the file

In this file you will fill in the code to use the turtle module to create an animation of hurricane Irma's path. In the file are 2 functions, irma_setup and irma. You are NOT allowed to modify the irma_setup function. Your code is to be limited to the irma function.

In the irma_setup, the following are done for you:

Creating the screen and turtle

The turtle's shape is changed to that of a hurricane

Loading a background image of the Atlantic

Setting the world coordinates of the screen to match the latitude and longitude on the map

In the starter zip file there is a file named irma.csv. This data was scraped from https://www.wunderground.com/hurricane/atlantic/2017/hurricane-irma, last access 9/14/2017. This file contains data about hurricane Irma. Each line contains 6 columns separated by commas (thus the .csv file extension). The file can be opened directly in PyCharm or opened in Excel for a columnar view. The first line of the file describes what each column is. Here are the first 3 lines of the file, separated into their columns:

Date Time Lat Lon Wind Pressure
30-Aug 15:00 GMT 16.4 -30.3 50 1004
30-Aug 21:00 GMT 16.4 -31.2 60 1001

The only columns relevant to your code are Lat (the latitude), Lon (the longitude), and Wind (the wind speed in miles per hour).

Using the data in irma.csv, your irma function must show hurricane Irma's path. Your solution must include the following:

Correctly show each point in the data file (together with lines between each point)

At each point, you must display what category the storm is, if it has hurricane strength winds, otherwise, draw no text.

Color code the hurricane strength:

Red for Category 5

Orange for Category 4

Yellow for Category 3

Green for Category 2

Blue for Category 1

Black if not hurricane strength

The thickness of the line should change in proportion to the hurricane category.

The data from the irma.csv file:

Date Time Lat Lon Wind Pressure
30-Aug 15:00 GMT 16.4 -30.3 50 1004
30-Aug 21:00 GMT 16.4 -31.2 60 1001
31-Aug 03:00 GMT 16.4 -32.2 65 999
31-Aug 09:00 GMT 16.5 -32.9 70 997
31-Aug 15:00 GMT 16.9 -33.8 100 979
31-Aug 21:00 GMT 17.3 -34.8 115 967
1-Sep 03:00 GMT 17.8 -35.6 115 967
1-Sep 09:00 GMT 18.2 -36.5 115 967
1-Sep 15:00 GMT 18.5 -37.8 110 972
1-Sep 21:00 GMT 18.8 -39.1 120 964
2-Sep 03:00 GMT 19.1 -40.5 115 967
2-Sep 09:00 GMT 19 -41.8 110 970
2-Sep 15:00 GMT 18.8 -43.3 110 973
2-Sep 21:00 GMT 18.5 -44.6 110 973
3-Sep 03:00 GMT 18.3 -46.2 110 973
3-Sep 09:00 GMT 18 -47.5 115 969
3-Sep 15:00 GMT 17.7 -48.4 115 969
3-Sep 21:00 GMT 17.6 -49.8 115 969
4-Sep 00:00 GMT 17.4 -50.3 115 959
4-Sep 03:00 GMT 17.2 -51 115 961
4-Sep 06:00 GMT 17 -51.5 115 961
4-Sep 09:00 GMT 16.9 -52.3 115 961
4-Sep 12:00 GMT 16.8 -52.6 120 947
4-Sep 15:00 GMT 16.8 -53.3 120 944
4-Sep 18:00 GMT 16.7 -53.8 120 944
4-Sep 21:00 GMT 16.7 -54.4 130 944
5-Sep 00:00 GMT 16.7 -55 140 943
5-Sep 03:00 GMT 16.7 -55.6 140 943
5-Sep 06:00 GMT 16.6 -56.4 145 939
5-Sep 09:00 GMT 16.6 -57 150 937
5-Sep 11:45 GMT 16.7 -57.7 175 929
5-Sep 12:00 GMT 16.7 -57.7 175 929
5-Sep 15:00 GMT 16.8 -58.4 180 931
5-Sep 18:00 GMT 16.9 -59.1 185 926
5-Sep 21:00 GMT 17.1 -59.8 185 926
6-Sep 00:00 GMT 17.2 -60.5 185 916
6-Sep 00:15 GMT 17.2 -60.5 185 916
6-Sep 03:00 GMT 17.4 -61.1 185 916
6-Sep 06:00 GMT 17.7 -61.8 185 914
6-Sep 09:00 GMT 17.9 -62.6 185 914
6-Sep 12:00 GMT 18.1 -63.3 185 918
6-Sep 15:00 GMT 18.2 -64 185 918
6-Sep 16:00 GMT 18.3 -64.2 185 922
6-Sep 17:00 GMT 18.4 -64.5 185 920
6-Sep 18:00 GMT 18.5 -64.7 185 920
6-Sep 19:00 GMT 18.6 -64.9 185 920
6-Sep 20:00 GMT 18.7 -65.1 185 920
6-Sep 21:00 GMT 18.8 -65.4 185 914
6-Sep 22:00 GMT 18.9 -65.6 185 914
6-Sep 23:00 GMT 19 -65.8 185 914
7-Sep 00:00 GMT 19.1 -66.1 185 914
7-Sep 01:00 GMT 19.2 -66.3 185 916
7-Sep 02:00 GMT 19.3 -66.6 185 916
7-Sep 03:00 GMT 19.4 -66.8 185 916
7-Sep 04:00 GMT 19.5 -67.1 185 918
7-Sep 05:00 GMT 19.6 -67.4 185 918
7-Sep 06:00 GMT 19.7 -67.7 180 921
7-Sep 07:00 GMT 19.7 -67.9 180 921
7-Sep 08:00 GMT 19.8 -68.1 180 921
7-Sep 09:00 GMT 20 -68.3 180 921
7-Sep 12:00 GMT 20.1 -69 180 921
7-Sep 15:00 GMT 20.4 -69.7 175 921
7-Sep 18:00 GMT 20.7 -70.4 175 922
7-Sep 21:00 GMT 20.9 -71.1 175 922
8-Sep 00:00 GMT 21.1 -71.8 175 919
8-Sep 03:00 GMT 21.3 -72.4 165 920
8-Sep 06:00 GMT 21.5 -73.3 160 925
8-Sep 09:00 GMT 21.7 -73.8 155 925
8-Sep 12:00 GMT 21.8 -74.7 150 927
8-Sep 15:00 GMT 22 -75.3 150 927
8-Sep 18:00 GMT 22 -76 155 925
8-Sep 21:00 GMT 22.1 -76.5 155 925
9-Sep 00:00 GMT 22.2 -77.2 155 924
9-Sep 03:00 GMT 22.1 -77.7 160 924
9-Sep 06:00 GMT 22.3 -78.2 160 930
9-Sep 09:00 GMT 22.5 -78.8 155 930
9-Sep 12:00 GMT 22.6 -79.6 130 937
9-Sep 15:00 GMT 22.8 -79.8 125 941
9-Sep 16:00 GMT 22.9 -79.9 125 941
9-Sep 17:00 GMT 23 -80 125 941
9-Sep 18:00 GMT 23.1 -80.2 125 941
9-Sep 19:00 GMT 23.1 -80.3 125 938
9-Sep 20:00 GMT 23.3 -80.4 125 938
9-Sep 21:00 GMT 23.4 -80.5 125 933
9-Sep 22:00 GMT 23.4 -80.7 125 933
9-Sep 23:00 GMT 23.4 -80.8 125 932
10-Sep 00:00 GMT 23.3 -80.8 120 932
10-Sep 01:00 GMT 23.4 -80.9 125 932
10-Sep 02:00 GMT 23.5 -81 120 933
10-Sep 03:00 GMT 23.5 -81 120 933
10-Sep 04:00 GMT 23.6 -81.1 120 932
10-Sep 05:00 GMT 23.7 -81.2 120 931
10-Sep 06:00 GMT 23.7 -81.3 130 931
10-Sep 07:00 GMT 23.9 -81.3 130 930
10-Sep 08:00 GMT 23.9 -81.4 130 928
10-Sep 09:00 GMT 24.1 -81.5 130 928
10-Sep 10:00 GMT 24.2 -81.4 130 929
10-Sep 11:00 GMT 24.4 -81.5 130 929
10-Sep 12:00 GMT 24.5 -81.5 130 929
10-Sep 13:00 GMT 24.6 -81.5 130 929
10-Sep 13:10 GMT 24.7 -81.5 130 929
10-Sep 14:00 GMT 24.8 -81.5 130 929
10-Sep 15:00 GMT 25 -81.5 130 933
10-Sep 15:10 GMT 25 -81.5 130 933
10-Sep 16:00 GMT 25.2 -81.6 130 933
10-Sep 17:00 GMT 25.4 -81.7 130 933
10-Sep 18:00 GMT 25.6 -81.8 120 936
10-Sep 19:00 GMT 25.7 -81.8 120 936
10-Sep 19:35 GMT 25.9 -81.7 115 940
10-Sep 20:00 GMT 26 -81.7 115 940
10-Sep 21:00 GMT 26.2 -81.8 110 938
10-Sep 22:00 GMT 26.3 -81.7 110 938
10-Sep 23:00 GMT 26.6 -81.7 110 940
11-Sep 00:00 GMT 26.7 -81.7 105 942
11-Sep 01:00 GMT 27.1 -81.8 105 942
11-Sep 02:00 GMT 27.3 -81.9 105 948
11-Sep 03:00 GMT 27.5 -81.9 100 952
11-Sep 04:00 GMT 27.7 -81.9 100 952
11-Sep 05:00 GMT 27.9 -82.1 100 952
11-Sep 06:00 GMT 28.2 -82.2 85 960
11-Sep 09:00 GMT 28.9 -82.6 75 965
11-Sep 12:00 GMT 29.5 -82.9 70 970
11-Sep 15:00 GMT 30.3 -83.1 65 975
11-Sep 18:00 GMT 30.8 -83.6 60 980
11-Sep 21:00 GMT 31.5 -84 50 985
12-Sep 00:00 GMT 31.9 -84.4 45 986
12-Sep 03:00 GMT 32.4 -84.9 35 988
12-Sep 09:00 GMT 33 -85.2 25 998
12-Sep 15:00 GMT 34.2 -87 10 1003
12-Sep 21:00 GMT 35.1 -88.2 10 1004

Example of what it should look like

image text in transcribed

Below is irma_setup:

import turtle def irma_setup(): """Creates the Turtle and the Screen with the map background  and coordinate system set to match latitude and longitude.   :return: a tuple containing the Turtle and the Screen   DO NOT CHANGE THE CODE IN THIS FUNCTION!  """  import tkinter turtle.setup(1025, 600) # set size of window to size of map   wn = turtle.Screen() wn.title("Hurricane Irma") # kludge to get the map shown as a background image,  # since wn.bgpic does not allow you to position the image  canvas = wn.getcanvas() turtle.setworldcoordinates(-110, 0, 0, 50) # set the coordinate system to match lat/long   map_bg_img = tkinter.PhotoImage(file="atlantic-hurricane-tracking-map.gif") # additional kludge for positioning the background image  # when setworldcoordinates is used  # for some reason I have to move it 15 less than than 1025 width  canvas.create_image(-1010, -600, anchor=tkinter.NW, image=map_bg_img) t = turtle.Turtle() wn.register_shape("hurricane.gif") t.shape("hurricane.gif") return (t, wn, map_bg_img) def irma(): """Animates the path of hurricane Irma  """  (t, wn, map_bg_img) = irma_setup() # your code to animate Irma goes here  # BEFORE the call to wn.exitonclick()   wn.exitonclick() if __name__ == "__main__": irma() 
Hurricane Irma U.S.A SPAIN NORTH ATLANTIC OCEAN ALGERIA MEXICO Mexico MAURITANIA MALI JAMAICA CAPE VERDE FASO GUINEA-BISSAUGUINEA COTES DTVOIRE PANAMA VENEZUELA St LEONE Monrev LIBERIA COLOMBIA BRAZIL Hurricane Irma U.S.A SPAIN NORTH ATLANTIC OCEAN ALGERIA MEXICO Mexico MAURITANIA MALI JAMAICA CAPE VERDE FASO GUINEA-BISSAUGUINEA COTES DTVOIRE PANAMA VENEZUELA St LEONE Monrev LIBERIA COLOMBIA BRAZIL

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago