Advertisement
MrsMcLead

ECS quake

Nov 25th, 2013
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. from turtle import *
  2. from tkinter import *
  3. import tkinter.simpledialog
  4. import tkinter.messagebox
  5.  
  6. root = Tk()
  7. w = Label(root, text="Quake Data")
  8. w.pack()
  9.  
  10. #Load seismic data from file into a List called data (ignoring time column)
  11. #data file should be in same folder as this file
  12. #Your file name might be different
  13. data = []
  14. for line in open('PE44.EHN.ascii'):
  15.     parts = line.split()
  16.     #applify data save as an int
  17.     data.append(int(float(parts[1])*250))
  18.  
  19. #1. Traverse List, find average, max and min.  Output them.
  20.    
  21.  
  22. #2. If the max was greater than 200, output that there was a possilbe earthquake
  23.  
  24.  
  25. #setup graph
  26. setup(width=1850, height=800)              
  27. pen = Pen()
  28. pen.speed('fastest')
  29. pen.up()
  30. x = -920
  31. pen.goto(-920,0)
  32. pen.down()
  33.  
  34.  
  35. #3. Graph Data sampling every 60 entries.  In other words, graph, skip 59, graph, skip 59, etc.
  36. #   Use pen.goto(x, y) to draw the lines.  y is the seismic reading.
  37. #   x will be time.  Increment x everytime through the loop so the graph continues to the right.
  38.  
  39. #4. If the data value is greater than 200 or less than -200, change the pen color to red.
  40. #   Otherwise, change it back to black.
  41. #5. Change the Data sampling to every 30 entries; every 100 entries.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement