Deborah R. Fowler
VSFX 160 -
Hurricane Tracker
Posted on June 18 2018
Updated on March 17 2024
This assignment was designed based on Nifty Assignments 2018 - Stanford Computer Science SIGCSE.
Hurricane Tracker by Phil Ventura
http://nifty.stanford.edu/2018/ventura-hurricane-tracker/nifty-hurricanes.html
The version you have been assigned is below:
Goals:
Understanding loops, file i/o, string manipulation and a start to graphics. The student will write a program to process real-world hurricane data and animate the path of hurricanes.
Requirements:
You are to write the code that animates the path of the hurricane along its track, while marking on the map the storm category at each point.
Files are supplied including:
- image file from NASA https://visibleearth.nasa.gov/view.php?id=74518
- txt data files created from Weather Underground's website
data, for example
- Python start up file to set up a turtle, window and coordinate system
DOWNLOAD the updated starter zip file and unzip
(right click and select Extract Here)
Open up hurricane.py in IDLE.The
setup is completed for you in hurricane_setup. It is your task to
use the turtle t to create an animation of the hurricane's path.
DO NOT modify hurricane_setup. It has been set up to:
- create the screen, turtle and turtle shape
- set up the background image of the Atlantic ocean
- set the coordinates of the screen to match the latitude and longitude on the map
Included in the start zip files are txt data files.
In the UpdatedStarterFiles folder you will find .txt files with the name of a hurricane.
Each file has the following data format:
Data format is as follows. Each column is separated by commas. You can take a look in IDLE or in any file editor to view.
The data you will need is Lat, Lon and Wind (mph), Storm Type which will then require you to assign the Category value
Lat, Lon will dictate position, category can be printed (note no value if Tropical Storm or Depression etc so anything not a "Hurricane" will be assigned zero) and wind can be used as a rough representative for turtle speed.
An example of what the results may look like is shown from the original https://youtu.be/c2uRG42M_nc
Using one of the files, say Ian2022.txt your hurricane function should show the hurricane path and include the following:
- Correctly show each point in the data file (with lines between each point)
- 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
- White if no hurricane strength
- Change the thickness of the line in proportion to the category
- Looping will make this task easier
- This quarter you will be asked to write an algorithm to "plan"
your code - to be handed in before the due date in your Dailies
folder
- Once coding starts:
- Strongly suggest first parsing the data and ensuring this functionality works (print it to confirm!)
- Work with one file, get the turtle drawing, then writing categories, then writing categories only when changed, then labels and finally the name of the hurricane
- the turtle should not start from (0,0) but should start
from the first data value
- To get the hurricane name there are multiple methods - I
would suggest either the method described in class using the
filename, or taking it from the first line of data
- Once working for one, you can try it on the other files in the data folder
- YOU ONLY NEED ONE FUNCTION - you can send in your filename to your hurricane function
- NOTE: The format of the data has been changed from previous
quarters.
HINT:
- Try creating a file with your favorite editor with values separated by spaces. Name this file testdata.txt and run the script as shown below
- Example file using python input (download
here)
- Example file using turtle write (download here)
Submission guidelines:
S24_V160_E2_LastnameFirstname_Title/
The directory should contain the following:
- hurricane.py (if you decide to use multiple files be sure the one named hurricane is the one that needs to be run to obtain the result)
- S24_V160_E2_LastnameFirstname.pdf or html (a brief description of information you would like to communicate. This document is to provide a user's guide noting any extra features you have added. In future, the pdf/html will provide a breakdown with your target audience being your peers.
Remember to test your files before handing in! Your files
will be tested on the data provide, so no hand editing data.
Create a version where the user is allowed to input the file name
and the hurricane paths or be able to drawn all in one window:
Other features - labels, continue until the user decides to quit,
labels and word categories, options to animate or not, show debug
data or not and so on.