Advertisement
tomdodd4598

Untitled

Oct 12th, 2023
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. from urllib.request import urlopen
  2.  
  3. # Get data as string
  4. x = urlopen('https://www.nsstc.uah.edu/data/msu/v6.0/tlt/uahncdc_lt_6.0.txt').read().decode('utf-8')
  5.  
  6. # Split data by line
  7. x = x.split('\n')
  8.  
  9. # Remove non-data lines
  10. x = x[1:539]
  11.  
  12. # Split data by whitespace
  13. x = [y.split() for y in x]
  14.  
  15. # Enumerate over Jan-Sep in years >= 2015
  16. x = tuple((i - 433, float(y[2])) for i, y in enumerate(x) if int(y[0]) >= 2015 and int(y[1]) < 10)
  17.  
  18. # Now plot this data with your tool of choice
  19. print(x)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement