# kludge to get the map shown as a background image, # since wn.bgpic does not allow you to position the image canvas = wn.getcanvas()
# set the coordinate system to match lat/long # DRF - parameters are llx lly urx ury (lower left and upper right) turtle.setworldcoordinates(-90, 0, -17.66, 45)
# DRF - Windows only supports gif, pgm, ppm unless you use the PIL library map_bg_img = tkinter.PhotoImage(file="images/atlantic-basin.gif")
# additional kludge for positioning the background image # when setworldcoordinates is used canvas.create_image(-1175, -580, anchor=tkinter.NW, image=map_bg_img)
t = turtle.Turtle() wn.register_shape("images/hurricane.gif") t.shape("images/hurricane.gif")
# set line and column for i, column inenumerate(f_csv): # use the enumerate function can get all the line number(enumerate = line number) # i = line number(the first variable) # skip headline: column = column.split(",") if i == 0: continue
建立函数内新列表
将需要用到的数据,进行整理,并合成一个新的列表
1 2 3 4 5 6 7
# set position,wind_speed,category: # coordinates =(Lon, Lat) position = float(column[3]), float(column[2]) category = column[-1][:-1] wind_speed = column[4][:-3] # group a new data(csv) data.append([position, category, wind_speed])