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.
 
 
 
 
 
 

17 lines
350 B

  1. #!/usr/bin/env python3
  2. import ephem
  3. import time
  4. import sys
  5. date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(sys.argv[1])+3*60*60))
  6. obs=ephem.Observer()
  7. obs.lat='change_latitude'
  8. obs.long='change_longitude'
  9. obs.date = date
  10. sun = ephem.Sun(obs)
  11. sun.compute(obs)
  12. sun_angle = float(sun.alt) * 57.2957795 # Rad to deg
  13. print(int(sun_angle))