A library that computes the ephemerides.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

44 lines
790 B

  1. #!/usr/bin/env python3
  2. from shutil import rmtree
  3. from pathlib import Path
  4. from skyfield.api import Loader
  5. from skyfield.timelib import Time
  6. from skyfield.nutationlib import iau2000b
  7. CACHE_FOLDER = str(Path.home()) + "/.kosmorro-cache"
  8. def get_loader():
  9. return Loader(CACHE_FOLDER)
  10. def get_timescale():
  11. return get_loader().timescale()
  12. def get_skf_objects():
  13. return get_loader()("de421.bsp")
  14. def get_iau2000b(time: Time):
  15. return iau2000b(time.tt)
  16. def clear_cache():
  17. rmtree(CACHE_FOLDER)
  18. def flatten_list(the_list: list):
  19. new_list = []
  20. for item in the_list:
  21. if isinstance(item, list):
  22. for item2 in flatten_list(item):
  23. new_list.append(item2)
  24. continue
  25. new_list.append(item)
  26. return new_list