Last active
December 3, 2019 12:15
-
-
Save viniroger/7d5be59941274e1711d35dc4cac6928a to your computer and use it in GitHub Desktop.
Return minutes from sunrise to sunset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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