Python Homework (.csv files images, creating graphs)
atlantic-basin.csv
945,600 0,45,-90,-17.66
atlantic-basin.png
badindex.csv
Date,Time,Lat,Lon,Wind,Pressure Aug 30,15:00 GMT,16.4,-30.3,50,1004 Aug 30, Aug 31,03:00 GMT,16.4,-32.2,65,999 Aug 31,09:00 GMT,16.5,-32.9,70,997
badvalue.csv
Date,Time,Lat,Lon,Wind,Pressure Aug 30,15:00 GMT,16.4,-30.3,50,1004 Aug 30,21:00 GMT,Three,-31.2,60,1001 Aug 31,03:00 GMT,16.4,-32.2,65,999 Aug 31,09:00 GMT,16.5,-32.9,70,997
gert.csv
| Date | Time | Lat | Lon | Wind | Pressure |
| Aug 13 | 03:00 GMT | 25.3 | -70.3 | 35 | 1011 |
| Aug 13 | 09:00 GMT | 26.5 | -70.9 | 35 | 1011 |
| Aug 13 | 15:00 GMT | 27.4 | -71.5 | 35 | 1011 |
| Aug 13 | 21:00 GMT | 28.1 | -71.7 | 40 | 1011 |
| Aug 14 | 03:00 GMT | 28.8 | -71.9 | 45 | 1009 |
| Aug 14 | 09:00 GMT | 29.7 | -72.2 | 45 | 1009 |
| Aug 14 | 15:00 GMT | 30.3 | -72.2 | 60 | 1002 |
| Aug 14 | 21:00 GMT | 30.6 | -72.3 | 70 | 992 |
| Aug 15 | 03:00 GMT | 31.2 | -72.3 | 75 | 986 |
| Aug 15 | 09:00 GMT | 31.8 | -72.5 | 75 | 986 |
| Aug 15 | 15:00 GMT | 32.8 | -72.0 | 75 | 986 |
| Aug 15 | 21:00 GMT | 33.7 | -71.2 | 80 | 981 |
| Aug 16 | 03:00 GMT | 34.8 | -70.3 | 85 | 979 |
| Aug 16 | 09:00 GMT | 36.0 | -68.4 | 90 | 975 |
| Aug 16 | 15:00 GMT | 37.4 | -65.7 | 90 | 975 |
| Aug 16 | 21:00 GMT | 38.7 | -62.4 | 100 | 970 |
| Aug 17 | 03:00 GMT | 40.1 | -58.4 | 105 | 967 |
| Aug 17 | 09:00 GMT | 41.7 | -54.0 | 100 | 968 |
| Aug 17 | 15:00 GMT | 43.2 | -50.0 | 80 | 975 |
| Aug 17 | 21:00 GMT | 44.8 | -46.0 | 65 | 985 |
hurricane.gif
irma.csv
| Date | Time | Lat | Lon | Wind | Pressure |
| Aug 30 | 15:00 GMT | 16.4 | -30.3 | 50 | 1004 |
| Aug 30 | 21:00 GMT | 16.4 | -31.2 | 60 | 1001 |
| Aug 31 | 03:00 GMT | 16.4 | -32.2 | 65 | 999 |
| Aug 31 | 09:00 GMT | 16.5 | -32.9 | 70 | 997 |
| Aug 31 | 15:00 GMT | 16.9 | -33.8 | 100 | 979 |
| Aug 31 | 21:00 GMT | 17.3 | -34.8 | 115 | 967 |
| Sep 1 | 03:00 GMT | 17.8 | -35.6 | 115 | 967 |
| Sep 1 | 09:00 GMT | 18.2 | -36.5 | 115 | 967 |
| Sep 1 | 15:00 GMT | 18.5 | -37.8 | 110 | 972 |
| Sep 1 | 21:00 GMT | 18.8 | -39.1 | 120 | 964 |
| Sep 2 | 03:00 GMT | 19.1 | -40.5 | 115 | 967 |
| Sep 2 | 09:00 GMT | 19.0 | -41.8 | 110 | 970 |
| Sep 2 | 15:00 GMT | 18.8 | -43.3 | 110 | 973 |
| Sep 2 | 21:00 GMT | 18.5 | -44.6 | 110 | 973 |
| Sep 3 | 03:00 GMT | 18.3 | -46.2 | 110 | 973 |
| Sep 3 | 09:00 GMT | 18.0 | -47.5 | 115 | 969 |
| Sep 3 | 15:00 GMT | 17.7 | -48.4 | 115 | 969 |
| Sep 3 | 21:00 GMT | 17.6 | -49.8 | 115 | 969 |
| Sep 4 | 00:00 GMT | 17.4 | -50.3 | 115 | 959 |
| Sep 4 | 03:00 GMT | 17.2 | -51.0 | 115 | 961 |
| Sep 4 | 06:00 GMT | 17.0 | -51.5 | 115 | 961 |
| Sep 4 | 09:00 GMT | 16.9 | -52.3 | 115 | 961 |
| Sep 4 | 12:00 GMT | 16.8 | -52.6 | 120 | 947 |
| Sep 4 | 15:00 GMT | 16.8 | -53.3 | 120 | 944 |
| Sep 4 | 18:00 GMT | 16.7 | -53.8 | 120 | 944 |
| Sep 4 | 21:00 GMT | 16.7 | -54.4 | 130 | 944 |
| Sep 5 | 00:00 GMT | 16.7 | -55.0 | 140 | 943 |
| Sep 5 | 03:00 GMT | 16.7 | -55.6 | 140 | 943 |
| Sep 5 | 06:00 GMT | 16.6 | -56.4 | 145 | 939 |
| Sep 5 | 09:00 GMT | 16.6 | -57.0 | 150 | 937 |
| Sep 5 | 11:45 GMT | 16.7 | -57.7 | 175 | 929 |
| Sep 5 | 12:00 GMT | 16.7 | -57.7 | 175 | 929 |
| Sep 5 | 15:00 GMT | 16.8 | -58.4 | 180 | 931 |
| Sep 5 | 18:00 GMT | 16.9 | -59.1 | 185 | 926 |
| Sep 5 | 21:00 GMT | 17.1 | -59.8 | 185 | 926 |
| Sep 6 | 00:00 GMT | 17.2 | -60.5 | 185 | 916 |
| Sep 6 | 00:15 GMT | 17.2 | -60.5 | 185 | 916 |
| Sep 6 | 03:00 GMT | 17.4 | -61.1 | 185 | 916 |
| Sep 6 | 06:00 GMT | 17.7 | -61.8 | 185 | 914 |
| Sep 6 | 09:00 GMT | 17.9 | -62.6 | 185 | 914 |
| Sep 6 | 12:00 GMT | 18.1 | -63.3 | 185 | 918 |
| Sep 6 | 15:00 GMT | 18.2 | -64.0 | 185 | 918 |
| Sep 6 | 16:00 GMT | 18.3 | -64.2 | 185 | 922 |
| Sep 6 | 17:00 GMT | 18.4 | -64.5 | 185 | 920 |
| Sep 6 | 18:00 GMT | 18.5 | -64.7 | 185 | 920 |
| Sep 6 | 19:00 GMT | 18.6 | -64.9 | 185 | 920 |
| Sep 6 | 20:00 GMT | 18.7 | -65.1 | 185 | 920 |
| Sep 6 | 21:00 GMT | 18.8 | -65.4 | 185 | 914 |
| Sep 6 | 22:00 GMT | 18.9 | -65.6 | 185 | 914 |
| Sep 6 | 23:00 GMT | 19.0 | -65.8 | 185 | 914 |
| Sep 7 | 00:00 GMT | 19.1 | -66.1 | 185 | 914 |
| Sep 7 | 01:00 GMT | 19.2 | -66.3 | 185 | 916 |
| Sep 7 | 02:00 GMT | 19.3 | -66.6 | 185 | 916 |
| Sep 7 | 03:00 GMT | 19.4 | -66.8 | 185 | 916 |
| Sep 7 | 04:00 GMT | 19.5 | -67.1 | 185 | 918 |
| Sep 7 | 05:00 GMT | 19.6 | -67.4 | 185 | 918 |
| Sep 7 | 06:00 GMT | 19.7 | -67.7 | 180 | 921 |
| Sep 7 | 07:00 GMT | 19.7 | -67.9 | 180 | 921 |
| Sep 7 | 08:00 GMT | 19.8 | -68.1 | 180 | 921 |
| Sep 7 | 09:00 GMT | 20.0 | -68.3 | 180 | 921 |
| Sep 7 | 12:00 GMT | 20.1 | -69.0 | 180 | 921 |
| Sep 7 | 15:00 GMT | 20.4 | -69.7 | 175 | 921 |
| Sep 7 | 18:00 GMT | 20.7 | -70.4 | 175 | 922 |
| Sep 7 | 21:00 GMT | 20.9 | -71.1 | 175 | 922 |
| Sep 8 | 00:00 GMT | 21.1 | -71.8 | 175 | 919 |
| Sep 8 | 03:00 GMT | 21.3 | -72.4 | 165 | 920 |
| Sep 8 | 06:00 GMT | 21.5 | -73.3 | 160 | 925 |
| Sep 8 | 09:00 GMT | 21.7 | -73.8 | 155 | 925 |
| Sep 8 | 12:00 GMT | 21.8 | -74.7 | 150 | 927 |
| Sep 8 | 15:00 GMT | 22.0 | -75.3 | 150 | 927 |
| Sep 8 | 18:00 GMT | 22.0 | -76.0 | 155 | 925 |
| Sep 8 | 21:00 GMT | 22.1 | -76.5 | 155 | 925 |
| Sep 9 | 00:00 GMT | 22.2 | -77.2 | 155 | 924 |
| Sep 9 | 03:00 GMT | 22.1 | -77.7 | 160 | 924 |
| Sep 9 | 06:00 GMT | 22.3 | -78.2 | 160 | 930 |
| Sep 9 | 09:00 GMT | 22.5 | -78.8 | 155 | 930 |
| Sep 9 | 12:00 GMT | 22.6 | -79.6 | 130 | 937 |
| Sep 9 | 15:00 GMT | 22.8 | -79.8 | 125 | 941 |
| Sep 9 | 16:00 GMT | 22.9 | -79.9 | 125 | 941 |
| Sep 9 | 17:00 GMT | 23.0 | -80.0 | 125 | 941 |
| Sep 9 | 18:00 GMT | 23.1 | -80.2 | 125 | 941 |
| Sep 9 | 19:00 GMT | 23.1 | -80.3 | 125 | 938 |
| Sep 9 | 20:00 GMT | 23.3 | -80.4 | 125 | 938 |
| Sep 9 | 21:00 GMT | 23.4 | -80.5 | 125 | 933 |
| Sep 9 | 22:00 GMT | 23.4 | -80.7 | 125 | 933 |
| Sep 9 | 23:00 GMT | 23.4 | -80.8 | 125 | 932 |
| Sep 10 | 00:00 GMT | 23.3 | -80.8 | 120 | 932 |
| Sep 10 | 01:00 GMT | 23.4 | -80.9 | 125 | 932 |
| Sep 10 | 02:00 GMT | 23.5 | -81.0 | 120 | 933 |
| Sep 10 | 03:00 GMT | 23.5 | -81.0 | 120 | 933 |
| Sep 10 | 04:00 GMT | 23.6 | -81.1 | 120 | 932 |
| Sep 10 | 05:00 GMT | 23.7 | -81.2 | 120 | 931 |
| Sep 10 | 06:00 GMT | 23.7 | -81.3 | 130 | 931 |
| Sep 10 | 07:00 GMT | 23.9 | -81.3 | 130 | 930 |
| Sep 10 | 08:00 GMT | 23.9 | -81.4 | 130 | 928 |
| Sep 10 | 09:00 GMT | 24.1 | -81.5 | 130 | 928 |
| Sep 10 | 10:00 GMT | 24.2 | -81.4 | 130 | 929 |
| Sep 10 | 11:00 GMT | 24.4 | -81.5 | 130 | 929 |
| Sep 10 | 12:00 GMT | 24.5 | -81.5 | 130 | 929 |
| Sep 10 | 13:00 GMT | 24.6 | -81.5 | 130 | 929 |
| Sep 10 | 13:10 GMT | 24.7 | -81.5 | 130 | 929 |
| Sep 10 | 14:00 GMT | 24.8 | -81.5 | 130 | 929 |
| Sep 10 | 15:00 GMT | 25.0 | -81.5 | 130 | 933 |
| Sep 10 | 15:10 GMT | 25.0 | -81.5 | 130 | 933 |
| Sep 10 | 16:00 GMT | 25.2 | -81.6 | 130 | 933 |
| Sep 10 | 17:00 GMT | 25.4 | -81.7 | 130 | 933 |
| Sep 10 | 18:00 GMT | 25.6 | -81.8 | 120 | 936 |
| Sep 10 | 19:00 GMT | 25.7 | -81.8 | 120 | 936 |
| Sep 10 | 19:35 GMT | 25.9 | -81.7 | 115 | 940 |
| Sep 10 | 20:00 GMT | 26.0 | -81.7 | 115 | 940 |
| Sep 10 | 21:00 GMT | 26.2 | -81.8 | 110 | 938 |
| Sep 10 | 22:00 GMT | 26.3 | -81.7 | 110 | 938 |
| Sep 10 | 23:00 GMT | 26.6 | -81.7 | 110 | 940 |
| Sep 11 | 00:00 GMT | 26.7 | -81.7 | 105 | 942 |
| Sep 11 | 01:00 GMT | 27.1 | -81.8 | 105 | 942 |
| Sep 11 | 02:00 GMT | 27.3 | -81.9 | 105 | 948 |
| Sep 11 | 03:00 GMT | 27.5 | -81.9 | 100 | 952 |
| Sep 11 | 04:00 GMT | 27.7 | -81.9 | 100 | 952 |
| Sep 11 | 05:00 GMT | 27.9 | -82.1 | 100 | 952 |
| Sep 11 | 06:00 GMT | 28.2 | -82.2 | 85 | 960 |
| Sep 11 | 09:00 GMT | 28.9 | -82.6 | 75 | 965 |
| Sep 11 | 12:00 GMT | 29.5 | -82.9 | 70 | 970 |
| Sep 11 | 15:00 GMT | 30.3 | -83.1 | 65 | 975 |
| Sep 11 | 18:00 GMT | 30.8 | -83.6 | 60 | 980 |
| Sep 11 | 21:00 GMT | 31.5 | -84.0 | 50 | 985 |
| Sep 12 | 00:00 GMT | 31.9 | -84.4 | 45 | 986 |
| Sep 12 | 03:00 GMT | 32.4 | -84.9 | 35 | 988 |
| Sep 12 | 09:00 GMT | 33.0 | -85.2 | 25 | 998 |
| Sep 12 | 15:00 GMT | 34.2 | -87.0 | 10 | 1003 |
| Sep 12 | 21:00 GMT | 35.1 | -88.2 | 10 | 1004 |
jose.csv
| Date | Time | Lat | Lon | Wind | Pressure |
| Sep 5 | 15:00 GMT | 12.3 | -39.1 | 40 | 1008 |
| Sep 5 | 21:00 GMT | 12.5 | -40.6 | 45 | 1006 |
| Sep 6 | 03:00 GMT | 12.3 | -41.7 | 50 | 1004 |
| Sep 6 | 09:00 GMT | 12.5 | -42.8 | 60 | 1002 |
| Sep 6 | 15:00 GMT | 13.1 | -44.5 | 70 | 998 |
| Sep 6 | 21:00 GMT | 13.9 | -45.8 | 75 | 994 |
| Sep 7 | 03:00 GMT | 14.4 | -47.5 | 85 | 989 |
| Sep 7 | 09:00 GMT | 14.8 | -49.1 | 90 | 986 |
| Sep 7 | 15:00 GMT | 14.9 | -50.6 | 90 | 986 |
| Sep 7 | 18:00 GMT | 15.2 | -51.4 | 105 | 978 |
| Sep 7 | 21:00 GMT | 15.5 | -52.4 | 120 | 966 |
| Sep 8 | 00:00 GMT | 15.6 | -53.2 | 120 | 966 |
| Sep 8 | 00:10 GMT | 15.6 | -53.2 | 120 | 966 |
| Sep 8 | 03:00 GMT | 15.6 | -53.9 | 120 | 966 |
| Sep 8 | 06:00 GMT | 15.8 | -54.4 | 120 | 966 |
| Sep 8 | 09:00 GMT | 16.0 | -55.3 | 125 | 957 |
| Sep 8 | 12:00 GMT | 16.1 | -56.2 | 125 | 957 |
| Sep 8 | 14:00 GMT | 16.2 | -56.9 | 150 | 942 |
| Sep 8 | 15:00 GMT | 16.3 | -57.1 | 150 | 942 |
| Sep 8 | 18:00 GMT | 16.4 | -57.7 | 150 | 940 |
| Sep 8 | 21:00 GMT | 16.6 | -58.3 | 150 | 940 |
| Sep 9 | 00:00 GMT | 16.7 | -58.8 | 150 | 938 |
| Sep 9 | 03:00 GMT | 16.9 | -59.3 | 155 | 938 |
| Sep 9 | 06:00 GMT | 17.2 | -59.6 | 150 | 940 |
| Sep 9 | 09:00 GMT | 17.5 | -60.3 | 150 | 940 |
| Sep 9 | 12:00 GMT | 17.8 | -60.7 | 145 | 944 |
| Sep 9 | 15:00 GMT | 18.3 | -61.3 | 145 | 945 |
| Sep 9 | 18:00 GMT | 18.8 | -61.9 | 145 | 945 |
| Sep 9 | 21:00 GMT | 19.2 | -62.4 | 145 | 945 |
| Sep 10 | 00:00 GMT | 19.4 | -62.9 | 145 | 945 |
| Sep 10 | 03:00 GMT | 19.8 | -63.4 | 130 | 944 |
| Sep 10 | 06:00 GMT | 20.4 | -64.0 | 130 | 944 |
| Sep 10 | 09:00 GMT | 20.8 | -64.5 | 130 | 944 |
| Sep 10 | 12:00 GMT | 21.2 | -65.3 | 130 | 944 |
| Sep 10 | 15:00 GMT | 21.7 | -65.8 | 130 | 944 |
| Sep 10 | 21:00 GMT | 22.8 | -66.9 | 120 | 956 |
| Sep 11 | 03:00 GMT | 23.7 | -68.1 | 115 | 962 |
| Sep 11 | 09:00 GMT | 24.4 | -68.6 | 105 | 968 |
| Sep 11 | 15:00 GMT | 25.5 | -69.1 | 105 | 968 |
| Sep 11 | 21:00 GMT | 26.4 | -69.2 | 100 | 973 |
| Sep 12 | 03:00 GMT | 27.1 | -69.5 | 85 | 982 |
| Sep 12 | 09:00 GMT | 27.5 | -69.0 | 75 | 987 |
| Sep 12 | 15:00 GMT | 27.5 | -68.3 | 75 | 987 |
| Sep 12 | 21:00 GMT | 27.6 | -67.4 | 75 | 987 |
| Sep 13 | 03:00 GMT | 26.5 | -66.4 | 75 | 985 |
| Sep 13 | 09:00 GMT | 26.1 | -66.0 | 75 | 985 |
| Sep 13 | 15:00 GMT | 25.5 | -65.6 | 75 | 985 |
| Sep 13 | 21:00 GMT | 25.3 | -65.6 | 75 | 988 |
| Sep 14 | 03:00 GMT | 25.2 | -66.0 | 80 | 985 |
| Sep 14 | 09:00 GMT | 25.1 | -66.5 | 75 | 986 |
| Sep 14 | 15:00 GMT | 24.9 | -66.6 | 70 | 989 |
| Sep 14 | 21:00 GMT | 25.2 | -67.3 | 70 | 989 |
| Sep 15 | 03:00 GMT | 25.5 | -68.0 | 70 | 989 |
| Sep 15 | 09:00 GMT | 25.9 | -68.7 | 70 | 989 |
| Sep 15 | 15:00 GMT | 26.5 | -69.4 | 70 | 989 |
| Sep 15 | 21:00 GMT | 27.1 | -70.3 | 75 | 983 |
| Sep 16 | 03:00 GMT | 27.4 | -71.0 | 80 | 983 |
| Sep 16 | 09:00 GMT | 27.9 | -71.8 | 80 | 983 |
| Sep 16 | 15:00 GMT | 28.8 | -72.2 | 80 | 982 |
| Sep 16 | 21:00 GMT | 28.9 | -71.9 | 80 | 973 |
| Sep 17 | 03:00 GMT | 29.2 | -71.8 | 80 | 973 |
| Sep 17 | 09:00 GMT | 30.0 | -71.7 | 80 | 973 |
| Sep 17 | 15:00 GMT | 31.0 | -71.9 | 90 | 967 |
| Sep 17 | 21:00 GMT | 31.5 | -71.8 | 90 | 967 |
| Sep 18 | 00:00 GMT | 31.9 | -71.7 | 90 | 972 |
| Sep 18 | 03:00 GMT | 32.2 | -71.6 | 90 | 972 |
| Sep 18 | 06:00 GMT | 32.6 | -71.6 | 90 | 972 |
| Sep 18 | 09:00 GMT | 33.0 | -71.4 | 85 | 974 |
| Sep 18 | 12:00 GMT | 33.5 | -71.2 | 85 | 976 |
| Sep 18 | 15:00 GMT | 33.9 | -71.1 | 75 | 977 |
| Sep 18 | 18:00 GMT | 34.2 | -71.0 | 75 | 977 |
| Sep 18 | 21:00 GMT | 34.8 | -71.1 | 75 | 977 |
| Sep 19 | 00:00 GMT | 34.8 | -71.5 | 75 | 973 |
| Sep 19 | 03:00 GMT | 35.2 | -71.3 | 75 | 975 |
| Sep 19 | 06:00 GMT | 35.6 | -71.3 | 75 | 971 |
| Sep 19 | 09:00 GMT | 36.0 | -71.3 | 75 | 971 |
| Sep 19 | 12:00 GMT | 36.3 | -71.6 | 75 | 973 |
| Sep 19 | 15:00 GMT | 36.5 | -71.7 | 75 | 976 |
| Sep 19 | 18:00 GMT | 36.9 | -71.5 | 75 | 976 |
| Sep 19 | 21:00 GMT | 37.2 | -71.3 | 75 | 976 |
| Sep 20 | 00:00 GMT | 37.5 | -71.2 | 75 | 973 |
| Sep 20 | 03:00 GMT | 37.9 | -70.8 | 70 | 973 |
| Sep 20 | 06:00 GMT | 38.2 | -70.5 | 70 | 973 |
| Sep 20 | 09:00 GMT | 38.4 | -70.3 | 65 | 975 |
| Sep 20 | 12:00 GMT | 38.8 | -70.2 | 65 | 976 |
| Sep 20 | 15:00 GMT | 39.0 | -70.0 | 70 | 976 |
| Sep 20 | 18:00 GMT | 39.2 | -69.3 | 70 | 976 |
| Sep 20 | 21:00 GMT | 39.2 | -69.1 | 70 | 976 |
| Sep 21 | 00:00 GMT | 39.4 | -68.6 | 65 | 979 |
| Sep 21 | 03:00 GMT | 39.5 | -68.2 | 60 | 982 |
| Sep 21 | 06:00 GMT | 39.8 | -67.8 | 60 | 982 |
| Sep 21 | 09:00 GMT | 39.8 | -67.8 | 60 | 982 |
| Sep 21 | 12:00 GMT | 39.6 | -68.1 | 60 | 982 |
| Sep 21 | 15:00 GMT | 39.6 | -68.2 | 60 | 984 |
| Sep 21 | 18:00 GMT | 39.5 | -67.9 | 60 | 984 |
| Sep 21 | 21:00 GMT | 39.6 | -67.9 | 50 | 987 |
| Sep 22 | 00:00 GMT | 39.6 | -68.1 | 50 | 987 |
| Sep 22 | 03:00 GMT | 39.5 | -68.4 | 50 | 987 |
| Sep 22 | 06:00 GMT | 39.6 | -68.5 | 50 | 987 |
| Sep 22 | 09:00 GMT | 39.7 | -68.7 | 50 | 990 |
| Sep 22 | 12:00 GMT | 39.7 | -69.0 | 50 | 993 |
| Sep 22 | 15:00 GMT | 39.5 | -69.4 | 45 | 993 |
| Sep 22 | 18:00 GMT | 39.3 | -69.3 | 45 | 995 |
| Sep 22 | 21:00 GMT | 39.3 | -69.1 | 45 | 996 |
lee.csv
| Date | Time | Lat | Lon | Wind | Pressure |
| Sep 15 | 03:00 GMT | 10.7 | -25.4 | 35 | 1010 |
| Sep 15 | 09:00 GMT | 10.6 | -27.3 | 35 | 1008 |
| Sep 15 | 15:00 GMT | 11.4 | -28.3 | 35 | 1008 |
| Sep 15 | 21:00 GMT | 12.6 | -29.7 | 35 | 1009 |
| Sep 16 | 03:00 GMT | 12.8 | -30.7 | 35 | 1009 |
| Sep 16 | 09:00 GMT | 12.6 | -32.1 | 35 | 1008 |
| Sep 16 | 15:00 GMT | 12.5 | -33.1 | 40 | 1007 |
| Sep 16 | 21:00 GMT | 12.6 | -34.2 | 40 | 1007 |
| Sep 17 | 03:00 GMT | 12.8 | -34.9 | 40 | 1007 |
| Sep 17 | 09:00 GMT | 13.0 | -35.4 | 40 | 1007 |
| Sep 17 | 15:00 GMT | 13.0 | -36.7 | 35 | 1007 |
| Sep 17 | 21:00 GMT | 13.2 | -37.3 | 35 | 1007 |
| Sep 18 | 03:00 GMT | 13.6 | -38.5 | 35 | 1007 |
| Sep 18 | 09:00 GMT | 14.1 | -39.8 | 35 | 1007 |
| Sep 18 | 15:00 GMT | 14.1 | -40.6 | 35 | 1007 |
| Sep 18 | 21:00 GMT | 15.0 | -42.3 | 35 | 1007 |
| Sep 19 | 03:00 GMT | 15.1 | -43.0 | 30 | 1007 |
| Sep 22 | 21:00 GMT | 30.8 | -48.9 | 35 | 1014 |
| Sep 23 | 03:00 GMT | 31.5 | -49.0 | 40 | 1009 |
| Sep 23 | 09:00 GMT | 31.9 | -49.2 | 40 | 1009 |
| Sep 23 | 15:00 GMT | 31.9 | -49.4 | 45 | 1007 |
| Sep 23 | 21:00 GMT | 32.1 | -49.8 | 45 | 1007 |
| Sep 24 | 03:00 GMT | 31.9 | -50.1 | 50 | 1003 |
| Sep 24 | 06:30 GMT | 31.9 | -50.1 | 75 | 987 |
| Sep 24 | 09:00 GMT | 31.8 | -50.1 | 85 | 983 |
| Sep 24 | 15:00 GMT | 31.4 | -49.9 | 90 | 982 |
| Sep 24 | 21:00 GMT | 31.3 | -49.7 | 90 | 980 |
| Sep 25 | 03:00 GMT | 31.1 | -49.5 | 90 | 980 |
| Sep 25 | 09:00 GMT | 31.1 | -49.4 | 90 | 980 |
| Sep 25 | 15:00 GMT | 30.8 | -49.9 | 90 | 980 |
| Sep 25 | 21:00 GMT | 30.5 | -50.6 | 85 | 983 |
| Sep 26 | 03:00 GMT | 30.2 | -51.5 | 90 | 979 |
| Sep 26 | 09:00 GMT | 30.0 | -52.5 | 100 | 977 |
| Sep 26 | 15:00 GMT | 29.9 | -53.7 | 105 | 975 |
| Sep 26 | 21:00 GMT | 29.9 | -54.6 | 110 | 971 |
| Sep 27 | 03:00 GMT | 30.0 | -55.5 | 110 | 971 |
| Sep 27 | 09:00 GMT | 30.2 | -56.3 | 110 | 971 |
| Sep 27 | 15:00 GMT | 30.6 | -56.8 | 115 | 963 |
| Sep 27 | 21:00 GMT | 31.2 | -57.1 | 115 | 962 |
| Sep 28 | 03:00 GMT | 31.7 | -57.3 | 110 | 966 |
| Sep 28 | 09:00 GMT | 32.5 | -57.2 | 110 | 966 |
| Sep 28 | 15:00 GMT | 33.7 | -57.0 | 100 | 973 |
| Sep 28 | 21:00 GMT | 35.1 | -55.8 | 90 | 977 |
| Sep 29 | 03:00 GMT | 36.3 | -54.6 | 80 | 984 |
| Sep 29 | 09:00 GMT | 38.3 | -52.4 | 75 | 987 |
| Sep 29 | 15:00 GMT | 40.1 | -49.5 | 70 | 992 |
| Sep 29 | 21:00 GMT | 42.2 | -46.0 | 65 | 996 |
| Sep 30 | 03:00 GMT | 44.3 | -42.8 | 60 | 998 |
| Sep 30 | 09:00 GMT | 46.7 | -35.6 | 50 | 998 |
maria.csv
| Date | Time | Lat | Lon | Wind | Pressure |
| Sep 16 | 15:00 GMT | 12.2 | -50.5 | 35 | 1008 |
| Sep 16 | 18:00 GMT | 11.9 | -51.6 | 35 | 1006 |
| Sep 16 | 21:00 GMT | 12.3 | -52.6 | 50 | 1002 |
| Sep 17 | 00:00 GMT | 12.4 | -53.0 | 50 | 1002 |
| Sep 17 | 03:00 GMT | 12.5 | -53.7 | 50 | 1002 |
| Sep 17 | 06:00 GMT | 12.7 | -54.4 | 50 | 1000 |
| Sep 17 | 09:00 GMT | 13.0 | -54.9 | 65 | 994 |
| Sep 17 | 12:00 GMT | 13.3 | -55.6 | 65 | 994 |
| Sep 17 | 15:00 GMT | 13.5 | -56.2 | 65 | 994 |
| Sep 17 | 18:00 GMT | 13.6 | -56.9 | 65 | 994 |
| Sep 17 | 21:00 GMT | 13.8 | -57.5 | 75 | 982 |
| Sep 18 | 00:00 GMT | 14.0 | -57.9 | 80 | 982 |
| Sep 18 | 03:00 GMT | 14.2 | -58.4 | 85 | 979 |
| Sep 18 | 06:00 GMT | 14.4 | -59.0 | 90 | 977 |
| Sep 18 | 09:00 GMT | 14.6 | -59.5 | 90 | 977 |
| Sep 18 | 12:00 GMT | 14.6 | -59.7 | 110 | 967 |
| Sep 18 | 15:00 GMT | 14.7 | -60.1 | 120 | 959 |
| Sep 18 | 18:00 GMT | 14.9 | -60.4 | 125 | 956 |
| Sep 18 | 21:00 GMT | 15.1 | -60.7 | 130 | 950 |
| Sep 18 | 22:00 GMT | 15.2 | -60.8 | 130 | 950 |
| Sep 18 | 23:00 GMT | 15.3 | -60.9 | 130 | 950 |
| Sep 18 | 23:45 GMT | 15.3 | -61.1 | 160 | 929 |
| Sep 19 | 00:00 GMT | 15.3 | -61.1 | 160 | 925 |
| Sep 19 | 01:00 GMT | 15.3 | -61.2 | 160 | 924 |
| Sep 19 | 01:35 GMT | 15.3 | -61.3 | 160 | 924 |
| Sep 19 | 03:00 GMT | 15.5 | -61.4 | 160 | 924 |
| Sep 19 | 06:00 GMT | 15.7 | -61.9 | 155 | 942 |
| Sep 19 | 09:00 GMT | 16.0 | -62.3 | 155 | 934 |
| Sep 19 | 09:10 GMT | 16.0 | -62.3 | 160 | 930 |
| Sep 19 | 12:00 GMT | 16.2 | -62.8 | 160 | 933 |
| Sep 19 | 15:00 GMT | 16.3 | -63.1 | 160 | 927 |
| Sep 19 | 18:00 GMT | 16.6 | -63.6 | 160 | 927 |
| Sep 19 | 18:15 GMT | 16.6 | -63.6 | 165 | 920 |
| Sep 19 | 19:00 GMT | 16.7 | -63.7 | 165 | 920 |
| Sep 19 | 20:00 GMT | 16.7 | -63.8 | 165 | 920 |
| Sep 19 | 21:00 GMT | 16.8 | -64.0 | 165 | 916 |
| Sep 19 | 22:00 GMT | 16.8 | -64.0 | 165 | 913 |
| Sep 19 | 23:00 GMT | 16.9 | -64.1 | 175 | 909 |
| Sep 20 | 00:00 GMT | 17.0 | -64.2 | 175 | 909 |
| Sep 20 | 01:00 GMT | 17.1 | -64.4 | 175 | 909 |
| Sep 20 | 02:00 GMT | 17.2 | -64.5 | 175 | 909 |
| Sep 20 | 03:00 GMT | 17.3 | -64.7 | 175 | 909 |
| Sep 20 | 04:00 GMT | 17.4 | -64.9 | 175 | 908 |
| Sep 20 | 05:00 GMT | 17.5 | -65.0 | 175 | 910 |
| Sep 20 | 06:00 GMT | 17.6 | -65.1 | 165 | 910 |
| Sep 20 | 07:00 GMT | 17.7 | -65.3 | 160 | 913 |
| Sep 20 | 08:00 GMT | 17.8 | -65.4 | 160 | 917 |
| Sep 20 | 09:00 GMT | 17.9 | -65.6 | 155 | 917 |
| Sep 20 | 10:00 GMT | 18.0 | -65.8 | 155 | 917 |
| Sep 20 | 10:35 GMT | 18.0 | -65.8 | 155 | 917 |
| Sep 20 | 11:00 GMT | 18.0 | -65.9 | 155 | 917 |
| Sep 20 | 12:00 GMT | 18.2 | -66.1 | 150 | 921 |
| Sep 20 | 13:00 GMT | 18.3 | -66.3 | 145 | 927 |
| Sep 20 | 14:00 GMT | 18.4 | -66.4 | 145 | 928 |
| Sep 20 | 15:00 GMT | 18.4 | -66.5 | 140 | 930 |
| Sep 20 | 18:00 GMT | 18.5 | -66.9 | 115 | 961 |
| Sep 20 | 21:00 GMT | 18.8 | -67.3 | 110 | 957 |
| Sep 21 | 00:00 GMT | 18.9 | -67.5 | 110 | 958 |
| Sep 21 | 03:00 GMT | 19.2 | -67.9 | 110 | 959 |
| Sep 21 | 06:00 GMT | 19.4 | -68.2 | 115 | 959 |
| Sep 21 | 09:00 GMT | 19.6 | -68.4 | 115 | 959 |
| Sep 21 | 12:00 GMT | 19.9 | -68.7 | 115 | 959 |
| Sep 21 | 15:00 GMT | 20.2 | -69.1 | 115 | 960 |
| Sep 21 | 18:00 GMT | 20.4 | -69.4 | 120 | 960 |
| Sep 21 | 21:00 GMT | 20.8 | -69.8 | 120 | 960 |
| Sep 22 | 00:00 GMT | 20.9 | -70.0 | 125 | 955 |
| Sep 22 | 03:00 GMT | 21.0 | -70.2 | 125 | 955 |
| Sep 22 | 06:00 GMT | 21.2 | -70.5 | 125 | 959 |
| Sep 22 | 09:00 GMT | 21.6 | -70.6 | 125 | 959 |
| Sep 22 | 12:00 GMT | 21.9 | -70.9 | 125 | 959 |
| Sep 22 | 15:00 GMT | 22.3 | -71.0 | 125 | 958 |
| Sep 22 | 18:00 GMT | 22.8 | -71.2 | 125 | 959 |
| Sep 22 | 21:00 GMT | 23.3 | -71.4 | 125 | 959 |
| Sep 23 | 00:00 GMT | 23.8 | -71.6 | 125 | 953 |
| Sep 23 | 03:00 GMT | 24.1 | -71.7 | 125 | 954 |
| Sep 23 | 06:00 GMT | 24.4 | -71.9 | 125 | 952 |
| Sep 23 | 09:00 GMT | 24.8 | -72.0 | 120 | 952 |
| Sep 23 | 15:00 GMT | 25.4 | -72.3 | 115 | 952 |
| Sep 23 | 21:00 GMT | 26.3 | -72.5 | 115 | 950 |
| Sep 24 | 03:00 GMT | 27.0 | -72.5 | 115 | 942 |
| Sep 24 | 09:00 GMT | 27.9 | -72.7 | 110 | 948 |
| Sep 24 | 15:00 GMT | 28.7 | -72.9 | 105 | 947 |
| Sep 24 | 21:00 GMT | 29.4 | -73.0 | 105 | 941 |
| Sep 25 | 00:00 GMT | 29.7 | -72.9 | 105 | 947 |
| Sep 25 | 03:00 GMT | 30.0 | -73.0 | 90 | 950 |
| Sep 25 | 06:00 GMT | 30.2 | -73.0 | 85 | 954 |
| Sep 25 | 09:00 GMT | 30.6 | -73.0 | 80 | 957 |
| Sep 25 | 12:00 GMT | 30.8 | -73.0 | 75 | 961 |
| Sep 25 | 15:00 GMT | 31.2 | -72.9 | 80 | 963 |
| Sep 25 | 18:00 GMT | 31.4 | -73.0 | 80 | 966 |
| Sep 25 | 21:00 GMT | 31.7 | -73.1 | 80 | 965 |
| Sep 26 | 00:00 GMT | 32.0 | -73.0 | 80 | 965 |
| Sep 26 | 03:00 GMT | 32.3 | -73.1 | 80 | 969 |
| Sep 26 | 06:00 GMT | 32.6 | -73.2 | 80 | 970 |
| Sep 26 | 09:00 GMT | 32.9 | -73.1 | 75 | 970 |
| Sep 26 | 12:00 GMT | 33.3 | -73.1 | 75 | 970 |
| Sep 26 | 15:00 GMT | 33.6 | -73.1 | 75 | 971 |
| Sep 26 | 18:00 GMT | 33.8 | -73.1 | 75 | 974 |
| Sep 26 | 21:00 GMT | 34.1 | -73.0 | 70 | 974 |
| Sep 27 | 00:00 GMT | 34.6 | -72.9 | 70 | 975 |
| Sep 27 | 03:00 GMT | 34.9 | -72.9 | 70 | 975 |
| Sep 27 | 06:00 GMT | 34.8 | -73.0 | 70 | 976 |
| Sep 27 | 09:00 GMT | 35.1 | -72.9 | 70 | 976 |
| Sep 27 | 12:00 GMT | 35.4 | -72.8 | 70 | 978 |
| Sep 27 | 15:00 GMT | 35.6 | -72.6 | 75 | 978 |
| Sep 27 | 18:00 GMT | 35.9 | -72.4 | 75 | 979 |
| Sep 27 | 21:00 GMT | 36.2 | -72.1 | 75 | 979 |
| Sep 28 | 00:00 GMT | 36.5 | -71.8 | 75 | 979 |
| Sep 28 | 03:00 GMT | 36.8 | -71.5 | 75 | 979 |
| Sep 28 | 09:00 GMT | 36.8 | -71.0 | 70 | 982 |
| Sep 28 | 15:00 GMT | 36.8 | -69.3 | 70 | 982 |
| Sep 28 | 21:00 GMT | 36.8 | -67.8 | 65 | 985 |
| Sep 29 | 03:00 GMT | 37.1 | -65.5 | 65 | 985 |
| Sep 29 | 09:00 GMT | 37.2 | -63.3 | 60 | 987 |
| Sep 29 | 15:00 GMT | 37.5 | -60.1 | 60 | 988 |
| Sep 29 | 21:00 GMT | 37.8 | -57.4 | 60 | 988 |
| Sep 30 | 03:00 GMT | 38.6 | -53.9 | 60 | 988 |
| Sep 30 | 09:00 GMT | 39.6 | -50.5 | 60 | 988 |
| Sep 30 | 15:00 GMT | 40.7 | -47.2 | 60 | 989 |
| Sep 30 | 21:00 GMT | 42.0 | -43.9 | 50 | 991 |
nate.csv
| Date | Time | Lat | Lon | Wind | Pressure |
| Oct 4 | 15:00 GMT | 12.2 | -81.9 | 35 | 1005 |
| Oct 4 | 18:00 GMT | 12.3 | -82.3 | 35 | 1005 |
| Oct 4 | 21:00 GMT | 12.5 | -82.5 | 35 | 1005 |
| Oct 5 | 00:00 GMT | 12.6 | -82.6 | 35 | 1005 |
| Oct 5 | 03:00 GMT | 12.8 | -82.7 | 35 | 1004 |
| Oct 5 | 06:00 GMT | 13.0 | -83.0 | 35 | 1004 |
| Oct 5 | 09:00 GMT | 13.3 | -83.3 | 35 | 1004 |
| Oct 5 | 12:00 GMT | 13.9 | -83.4 | 40 | 999 |
| Oct 5 | 15:00 GMT | 14.3 | -83.7 | 40 | 999 |
| Oct 5 | 18:00 GMT | 14.5 | -84.0 | 40 | 1001 |
| Oct 5 | 21:00 GMT | 14.9 | -84.3 | 40 | 1000 |
| Oct 6 | 00:00 GMT | 15.3 | -84.5 | 40 | 1000 |
| Oct 6 | 03:00 GMT | 15.8 | -84.7 | 40 | 1000 |
| Oct 6 | 06:00 GMT | 16.1 | -84.8 | 45 | 999 |
| Oct 6 | 09:00 GMT | 16.9 | -85.1 | 45 | 999 |
| Oct 6 | 12:00 GMT | 17.8 | -84.8 | 45 | 996 |
| Oct 6 | 15:00 GMT | 18.7 | -85.0 | 50 | 996 |
| Oct 6 | 18:00 GMT | 19.4 | -85.3 | 50 | 996 |
| Oct 6 | 21:00 GMT | 20.3 | -85.7 | 60 | 993 |
| Oct 7 | 00:00 GMT | 21.4 | -85.9 | 65 | 990 |
| Oct 7 | 03:00 GMT | 22.3 | -86.4 | 70 | 990 |
| Oct 7 | 03:30 GMT | 22.4 | -86.3 | 75 | 988 |
| Oct 7 | 06:00 GMT | 23.5 | -86.5 | 80 | 987 |
| Oct 7 | 09:00 GMT | 24.5 | -87.0 | 80 | 987 |
| Oct 7 | 12:00 GMT | 25.7 | -88.0 | 85 | 986 |
| Oct 7 | 15:00 GMT | 26.6 | -88.4 | 90 | 984 |
| Oct 7 | 18:00 GMT | 27.6 | -88.9 | 90 | 982 |
| Oct 7 | 21:00 GMT | 28.4 | -89.1 | 90 | 981 |
| Oct 8 | 00:00 GMT | 29.0 | -89.2 | 85 | 982 |
| Oct 8 | 03:00 GMT | 29.9 | -89.1 | 85 | 984 |
| Oct 8 | 05:30 GMT | 30.4 | -89.0 | 85 | 984 |
| Oct 8 | 06:00 GMT | 30.5 | -88.9 | 85 | 984 |
| Oct 8 | 09:00 GMT | 31.5 | -88.4 | 70 | 986 |
| Oct 8 | 12:00 GMT | 32.0 | -88.0 | 45 | 994 |
| Oct 8 | 15:00 GMT | 33.1 | -87.3 | 35 | 996 |
| Oct 8 | 21:00 GMT | 35.0 | -86.5 | 35 | 997 |
| Oct 9 | 03:00 GMT | 36.4 | -85.5 | 35 | 1002 |
| Oct 9 | 09:00 GMT | 40.7 | -81.7 | 15 | 1004 |
| Oct 9 | 15:00 GMT | 41.8 | -79.5 | 30 | 1006 |
Program 4 - Hurricane Plotter.docx
CS 101
Spring 2019
Algorithm Due: Mar 10th, 2019
Program Due: Mar 17th, 2019
All work submitted must be your own.
Deliverables:
You must use functions to modularize your work in a logical way.
You should use exception handling where necessary as well.
All submitted work must be your own.
50 points off for programs that crash on expected input.
Hurricane Plotting
This project will have you using error handling and file handling to plot the path of hurricanes. The zip file contains all the data files, images and modules you will need for the program. The datafiles are .csv, you may find using the csv module easier to use. However, you can always read in a line and use. split. Below is the image for hurricane irma path. This image is not complete as there are more datapoints that haven’t been drawn yet.
Hurricane.csv files.
There are multiple csv files for different named hurricanes. (The atlantic-basin.csv file is not a storm file, but contains region information about the map. More about that later.). Each line in the storm csv file contains information about the storm at a particular point and time. The first 4 lines of irma.csv appear in below
Date,Time,Lat,Lon,Wind,Pressure
Aug 30,15:00 GMT,16.4,-30.3,50,1004
Aug 30,21:00 GMT,16.4,-31.2,60,1001
Aug 31,03:00 GMT,16.4,-32.2,65,999
The first line only tells us what the columns are, we will always assume the columns are in the same order. After that line we get information about date, time lat, lon, wind and pressure. We will only be concerned with lat, lon and wind speed.
At each line we’ll want to mark the hurricane on the map with the latitude, longitude line weight and color to draw the line. The Line weight and color are determined by the category of the storm. Hurricane categories go from 0 to 5. The line weight should be proportional to the category. You can decide on how much weight to give it. The color by category is given below.
|
Wind Speed |
Category |
Color |
|
[0-74) |
0 |
white |
|
[74-96) |
1 |
blue |
|
[96-111) |
2 |
green |
|
[111-130) |
3 |
yellow |
|
[130-157) |
4 |
orange |
|
[157- |
5 |
red |
windowUtil module
The window util module will help you create the graphic window and display the map and hurricane data. As long as the solution is in the same directory, you can simply import the module like any other.
import windowUtil
Creating a window
To create a new window we must create a WindowUtil instance and initialize it. It takes 4 arguments, the name of the window, the width, the height and the name of the image file to use for the background.
win = windowUtil.Window("Hurricane Data", 1000, 900, img="atlantic-basin.png")
You’ll notice that this creates a window slightly larger than our image. (We’ll use the atlantic-basin.csv image for data about the image size as well as the lat and longitude boundaries)
The win variable above is an instance of the class that handles our window. We use it to call methods to plot the hurricane and update the screen.
Setting the map boundaries
After we’ve created our window, we need to tell it where the boundaries are for the lat and long, so that it can translate them onto the map. The set range method takes 4 arguments, lat1, lat2, long1, and long2.
win.set_range(0, 45, -90, -17.66)
This tells it that the lowest latitude is 0 and the highest latitude shown is 45. The left hand side longitude is -90 degrees and the right hand side longitude is -17.66 degrees.
Plotting the hurricane
The plot_hurricane method takes 4 arguments, the lat, long, linewidth, and color of the hurricane at that point. After we plot the hurricane we need to refresh the screen and we can do so with the update method. This method takes no arguments.
win.plot_hurricane(16.4, -30.3, 2, "blue")
win.update()
You’ll notice it plots the hurricane graphic on our screen. The image of the hurricane isn’t blue, but if there was a line drawn up to that point it would be blue. Now try another spot, just a little farther away.
win.plot_hurricane(18, -50, 5, "red")
win.update()
If the window isn’t available because the user closed it, then win.update() will throw an exception the exception is windowUtil.WindowCloseError
The hurricane isn’t positioned correctly on this map simply because our map didn’t cover the entire size of the window. Changing the window size to 945, 600 will alleviate that.
That’s all you will need in order to create a window and plot the hurricane. Pretty easy.
atlantic-basin.csv
This csv contains information about how the .png file should be displayed. The first line is the width and the high. In this case 945x600.
The next line contains lat1, lat2, long1, and long2. These are the latitude and longitude boundaries for the given map. You should not hard code these into your program. The grader may use a different map and different values to test your solution.
CSV Module
The csv module is very useful for reading through csv files. You don’t have to use it, but you may find it easier than the .split() method. You open and close a file as you normally would, but then pass the file handle to the reader function. This returns a csv handle that you can iterate over. It will automatically read each line is a list that has been split on the commas.
import csv
fh = open("irma.csv")
fh_csv = csv.reader(fh)
for line in fh_csv:
print(line)
fh.close()
time Module
After each call to update you should let python sleep for a fraction of a second. Otherwise it will draw the map too quickly and you won’t see the process of it drawing. Just import time module at the top of the program and call time.sleep(0.2) This puts the python thread to sleep for 2 tenths of a second, letting the user see and enjoy your map as it gets drawn.
Requirements
· Ask the user for the name of the file to open. It should continually ask until the user responds with a file that can be opened. The user may enter quit and the program will exit
· Display the hurricane at each lat and longitude from the input file. You’ll need to convert the lat, long and windspeed into floats. Some files may have bad data, and you should catch the ValueError if they cannot be converted and show the user a nice error message and then go to the next line. Some lines also might not contain the correct number of columns, so an IndexError may occur. You should respond to those as well.
· Once the hurricane has been mapped you should continue to update the map so that the hurricane icon animates and wait for the user to close the window.
· Once the window is closed ask the user to display another hurricane image as shown in the example
Development notes.
· All import statements should be at the top of the program.
· Don’t try to write it all at once, take your time and work on one skill at a time.
https://umkc.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=fddfc482-3a06-49c9-bfe8-a9ce0119f93b
Example
Enter the name of the hurricane file (quit to exit) ==> badfile
Could not open the file, please enter another.
Enter the name of the hurricane file (quit to exit) ==> badindex.csv
Index error, line did not contain all columns ['Aug 30', '']
Thanks for viewing!
Enter the name of the hurricane file (quit to exit) ==> badvalue.csv
Could not convert value to float ['Aug 30', '21:00 GMT', 'Three', '-31.2', '60', '1001']
Thanks for viewing!
Enter the name of the hurricane file (quit to exit) ==> irma.csv
Thanks for viewing!
Enter the name of the hurricane file (quit to exit) ==> Quit
Program 4 - Hurricane Plotter.pdf
CS 101
Spring 2019
Algorithm Due: Mar 10th, 2019
Program Due: Mar 17th, 2019
All work submitted must be your own.
Deliverables: You must use functions to modularize your work in a logical way. You should use exception handling where necessary as well. All submitted work must be your own. 50 points off for programs that crash on expected input.
Hurricane Plotting This project will have you using error handling and file handling to plot the path of hurricanes.
The zip file contains all the data files, images and modules you will need for the program. The
datafiles are .csv, you may find using the csv module easier to use. However, you can always
read in a line and use. split. Below is the image for hurricane irma path. This image is not
complete as there are more datapoints that haven’t been drawn yet.
Hurricane.csv files.
There are multiple csv files for different named hurricanes. (The atlantic-basin.csv file is not a
storm file, but contains region information about the map. More about that later.). Each line in
the storm csv file contains information about the storm at a particular point and time. The first 4
lines of irma.csv appear in below
Date,Time,Lat,Lon,Wind,Pressure
Aug 30,15:00 GMT,16.4,-30.3,50,1004
Aug 30,21:00 GMT,16.4,-31.2,60,1001
Aug 31,03:00 GMT,16.4,-32.2,65,999
The first line only tells us what the columns are, we will always assume the columns are in the
same order. After that line we get information about date, time lat, lon, wind and pressure. We
will only be concerned with lat, lon and wind speed.
At each line we’ll want to mark the hurricane on the map with the latitude, longitude line weight
and color to draw the line. The Line weight and color are determined by the category of the
storm. Hurricane categories go from 0 to 5. The line weight should be proportional to the
category. You can decide on how much weight to give it. The color by category is given below.
Wind Speed Category Color
[0-74) 0 white
[74-96) 1 blue
[96-111) 2 green
[111-130) 3 yellow
[130-157) 4 orange
[157- 5 red
windowUtil module
The window util module will help you create the graphic window and display the map and
hurricane data. As long as the solution is in the same directory, you can simply import the
module like any other.
import windowUtil
Creating a window
To create a new window we must create a WindowUtil instance and initialize it. It takes 4
arguments, the name of the window, the width, the height and the name of the image file to use
for the background.
win = windowUtil.Window("Hurricane Data", 1000, 900, img="atlantic-
basin.png")
You’ll notice that this creates a window slightly larger than our image. (We’ll use the atlantic-
basin.csv image for data about the image size as well as the lat and longitude boundaries)
The win variable above is an instance of the class that handles our window. We use it to call
methods to plot the hurricane and update the screen.
Setting the map boundaries
After we’ve created our window, we need to tell it where the boundaries are for the lat and long,
so that it can translate them onto the map. The set range method takes 4 arguments, lat1, lat2,
long1, and long2.
win.set_range(0, 45, -90, -17.66)
This tells it that the lowest latitude is 0 and the highest latitude shown is 45. The left hand side
longitude is -90 degrees and the right hand side longitude is -17.66 degrees.
Plotting the hurricane
The plot_hurricane method takes 4 arguments, the lat, long, linewidth, and color of the hurricane
at that point. After we plot the hurricane we need to refresh the screen and we can do so with
the update method. This method takes no arguments.
win.plot_hurricane(16.4, -30.3, 2, "blue")
win.update()
You’ll notice it plots the hurricane graphic on our screen. The image of the hurricane isn’t blue,
but if there was a line drawn up to that point it would be blue. Now try another spot, just a little
farther away.
win.plot_hurricane(18, -50, 5, "red")
win.update()
If the window isn’t available because the user closed it, then win.update() will throw an
exception the exception is windowUtil.WindowCloseError
The hurricane isn’t positioned correctly on this map simply because our map didn’t cover the
entire size of the window. Changing the window size to 945, 600 will alleviate that.
That’s all you will need in order to create a window and plot the hurricane. Pretty easy.
atlantic-basin.csv
This csv contains information about how the .png file should be displayed. The first line is the
width and the high. In this case 945x600.
The next line contains lat1, lat2, long1, and long2. These are the latitude and longitude
boundaries for the given map. You should not hard code these into your program. The grader
may use a different map and different values to test your solution.
CSV Module
The csv module is very useful for reading through csv files. You don’t have to use it, but you
may find it easier than the .split() method. You open and close a file as you normally would, but
then pass the file handle to the reader function. This returns a csv handle that you can iterate
over. It will automatically read each line is a list that has been split on the commas.
import csv
fh = open("irma.csv")
fh_csv = csv.reader(fh)
for line in fh_csv:
Program4_Solution.py
windowUtil.py
import time # tkinter is used for UI try: import tkinter as tk except ImportError: import Tkinter as tk class WindowCloseError(Exception): pass class Window(object): def __init__(self, title, width, height, img=None, background="Black"): self.__root = tk.Tk() self.width = width self.height = height self.canvas = tk.Canvas(self.__root, width=width, height=height) self.__root.resizable(width=False, height=False) self.__root.geometry('{}x{}'.format(width, height)) self.__root.title(title) if img is not None: self.filename = tk.PhotoImage(file=img) else: self.filename = None self.hurricane_imgs = [tk.PhotoImage(file='hurricane.gif', format = 'gif -index %i' %(i)) for i in range(5)] self.hurricane_index = 0 self.canvas.create_image(0, 0, image=self.filename, anchor="nw") self.paths = [] # all teh recorded hurricane paths to be drawn each time. self.current_x = None self.current_y = None #self.canvas.create_line(100, 100, 200, 200, fill="red", width=12) #hurricane_label = tk.Label(self.__root, image=self.hurricane_img) #hurricane_label.place(x=100, y=100) self.canvas.pack() def set_range(self, lat1, lat2, long1, long2): self.lat1 = lat1 self.lat2 = lat2 self.long1 = long1 self.long2 = long2 def plot_hurricane(self, lat, long, linewidth=1, color="black"): try: lat_p = (lat - self.lat1) / (self.lat2 - self.lat1) long_p = (long - self.long1) / (self.long2 - self.long1) y = self.height - lat_p * self.height x = long_p * self.width self.__set_hurricane(x, y, linewidth, color) except tk.TclError: raise WindowCloseError def __set_hurricane(self, x, y, linewidth=1, color="black"): if self.current_x is not None and self.current_y is not None: tuple_info = (self.current_x, self.current_y, x, y, linewidth, color) self.paths.append(tuple_info) self.current_x = x self.current_y = y def __draw_path(self): for x1, y1, x2, y2, lw, color in self.paths: self.canvas.create_line(x1, y1, x2, y2, fill=color, width=lw) def __draw_hurricane(self): if self.current_x is not None and self.current_y is not None: img = self.hurricane_imgs[self.hurricane_index] actual_x = self.current_x - img.width() // 2 actual_y = self.current_y - img.height() // 2 self.canvas.create_image(actual_x, actual_y, image=img, anchor="nw") def update(self): try: self.canvas.delete("all") self.hurricane_index += 1 self.hurricane_index %= len(self.hurricane_imgs) self.canvas.create_image(0, 0, image=self.filename, anchor="nw") self.__draw_path() self.__draw_hurricane() self.canvas.pack() self.__root.update() except tk.TclError: raise WindowCloseError