Skip to content

Instantly share code, notes, and snippets.

@viniroger
Last active December 3, 2019 12:15
Show Gist options
  • Save viniroger/7d5be59941274e1711d35dc4cac6928a to your computer and use it in GitHub Desktop.
Save viniroger/7d5be59941274e1711d35dc4cac6928a to your computer and use it in GitHub Desktop.
Return minutes from sunrise to sunset
# conda install -c conda-forge astral
import astral
@staticmethod
def sun_min(place):
"""
Return minutes from sunrise to sunset
"""
l = astral.Location()
l.latitude = -15.60083333
l.longitude = -47.71305556
l.timezone = 'UTC'
sunrise = l.sun()['dawn']
sunset = l.sun()['sunset']
print(sunrise)
print(sunset)
suntime = sunset - sunrise
min_day = suntime.total_seconds()/60
return min_day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment