Advertisement
Guest User

Untitled

a guest
Oct 6th, 2023
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. from skyfield import almanac
  2.  
  3. def main():
  4. ephemeris = api.load('de441.bsp')
  5. ts = api.load.timescale()
  6. utc = pytz.timezone("UTC")
  7. start = ts.utc(2023, 10, 1) # April 1, 2023
  8. stop = ts.utc(2023, 12, 31) # June 30, 2024
  9.  
  10. # Get the function for moon's ascending node
  11. f = almanac.moon_nodes(ephemeris)
  12.  
  13. # Find times when the function transitions from negative to positive
  14. t, y = almanac.find_discrete(start, stop, f)
  15.  
  16. # Filter times by y == 1 (ascending node)
  17. ascending_node_times = t[y == 1]
  18.  
  19. print('\n'.join(str(t.astimezone(utc)) for t in ascending_node_times))
  20.  
  21. if __name__ == '__main__':
  22. main()
  23.  
  24.  
  25. python skyfieldnode3.py
  26. 2023-10-28 03:13:52.258425+00:00
  27. 2023-11-24 11:01:59.968357+00:00
  28. 2023-12-21 13:53:36.815745+00:00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement