Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dawn/Dusk #225

Closed
Bernmeister opened this issue Dec 5, 2018 · 4 comments
Closed

Dawn/Dusk #225

Bernmeister opened this issue Dec 5, 2018 · 4 comments
Assignees

Comments

@Bernmeister
Copy link

In the olden days of PyEphem, to calculate dawn/dusk, I used this for inspiration.

For Skyfield, I have looked at the Topos object (both API and under a debugger) but I don't see a field for horizon (horizon should be set to say -6 degrees for civil twilight).

Is it possible to calculate dawn/dusk in Skyfield (and if so, how)?

@brandon-rhodes
Copy link
Member

Twilight calculations would be a nice new feature, so I'll keep this issue open until there's a chance to add them. In the meantime, you could make your own copy of sunrise_sunset:

def sunrise_sunset(ephemeris, topos):

but instead of the value -0.8333, you would use an even deeper angle — here are the angles used by the Naval Observatory:

https://aa.usno.navy.mil/faq/docs/RST_defs.php#twilight

@brandon-rhodes brandon-rhodes self-assigned this Dec 7, 2018
@boonhapus
Copy link

@brandon-rhodes Would you consider it overkill to use your library in place of astral for this sort of thing? This issue is timely, as I found your work here while trying to dig up an old script that used PyEphem. Being able to pinpoint the phases of twilight is very interesting to me.

@brandon-rhodes
Copy link
Member

I think that Skyfield times for twilight would more precisely agree with the official numbers from the USNO than would numbers from PyEphem, which might if you measured them be sometimes one minute different because of small differences in its estimation of where the Sun and Earth are. But my guess is that either library would be well within the precision you need, given that dusk and dawn never proceed exactly according to plan anyway because of humidity and air layers and clouds.

What precision does your application need? That's the first question.

@ghost
Copy link

ghost commented Dec 17, 2018

Since skyfield uses SPICE kernel files, it should agree to the minute with USNO, assuming it uses an elliptical Earth model (which I'm sure it does). It wouldn't be hard to test against USNO's data.

This isn't exactly helpful, but my https://github.com/barrycarter/bcapps/tree/master/ASTRO/testdata/ contains a bunch of sun/moon rise/set data I collected from USNO ages ago. It does not include twilight data, but confirming sun (and especially moon) rise/set to the nearest minute would probably be useful.

Additionally, if you need more tests cases for twilight, let me know, and I can generate these as well (my https://github.com/barrycarter/bcapps/tree/master/bclib.pl has a get_usno_calendar function that automates getting USNO calendars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants