roweder
Posts: 2
Joined: Mon Jun 10, 2019 8:45 pm

Angle of the Sun from a Python Library

Mon Jun 10, 2019 8:57 pm

I'm new to python and Raspberry Pi, and I'm not sure where to look for available python libraries. Please pardon me if this is a question I should not have wasted forum users' time with. I am looking for a python library that can compute this basic function:

Given the information:
Location coordinates
Date

Compute the following:
Time when the sun is at -18 degrees (below horizon) before sunrise
Time when the sun is at 0 degrees (time of sunrise)
Time when the sun is at 0 degrees (time of sunset)
Time when the sun is at -18 degrees (below horizon) after sunset

Does a library capable of this exist? I'm hoping to use it to program a cat feeder to feed my cats based on their circadian rhythm, and have it compute feeding times based on the sun's trajectory for that day.

User avatar
DougieLawson
Posts: 35381
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Angle of the Sun from a Python Library

Tue Jun 11, 2019 7:08 am

Start here: https://rhodesmill.org/pyephem/ follow the links to the replacement Ephemeris libraries.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
B.Goode
Posts: 7876
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Angle of the Sun from a Python Library

Tue Jun 11, 2019 7:24 am

Welcome to the Raspberry Pi forums.

I haven't checked whether they might meet your specific requirements, but some possible solutions include Skyfield, Astropy and PyEphem.

Ref: https://rhodesmill.org/pyephem/

roweder
Posts: 2
Joined: Mon Jun 10, 2019 8:45 pm

Re: Angle of the Sun from a Python Library

Tue Jun 11, 2019 2:13 pm

Thank you! DougieLawson and B.Goode, I'll have a look at those.

Return to “Beginners”