Advertisement
jukaukor

kuunvaiheet.py

Jan 5th, 2023 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #Kuun vaiheet aikana t0 -> t1
  2. # tulostaa UT-ajassa eli Greenwichin ajassa
  3. #Kuun vaiheet aikana t0 -> t1
  4. # tulostaa UT-ajassa eli Greenwichin ajassa
  5. # Juhani Kaukoranta 5.1.2023 (korjattu 6.1.2023)
  6. # latausivusto JPL:n paketille de421.bsp:
  7. # paketti ladataan vain kerran, se jää hakemistoon
  8. print(" sivusto, josta voi ladata datapaketin de421.bsp")
  9. print("https://github.com/…/python…/blob/master/ci/de421.bsp")
  10. from skyfield import api
  11. from skyfield import almanac
  12. ts = api.load.timescale()
  13. eph = api.load('de421.bsp') # on ladattuna NASA:lta
  14. print("Mistä alkaen, vuosi kk päivä, esim 2023 1 1")
  15. line = [int(x) for x in input().split() ]
  16. year1,month1,day1 = line[0],line[1],line[2]
  17. print("Mihin asti, vuosikk päivä, esim 2023 6 1")
  18. line = [int(x) for x in input().split()]
  19. year2,month2,day2 = line[0],line[1],line[2]
  20. #t = ts.utc(2023, 2, 28) # malli
  21. t0 = ts.utc(year1,month1,day1) # alkupäiväys
  22. t1 = ts.utc(year2,month2,day2) # loppupäiväys
  23. t, y = almanac.find_discrete(t0, t1, almanac.moon_phases(eph))
  24. print("kellonajat UTC (Greenwich) ajassa")
  25. for i in range(0,len(y)): print(almanac.MOON_PHASES[y[i]] , t.utc_iso()[i]," UT")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement