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
407 B

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