-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Eclipse Functionality #445
Comments
Thanks for the sample code! It might help folks who find this issue from a Google search and are interested in reading the tables themselves, and also having this issue open can replace that old todo item. The goal of the todo item, however, is for Skyfield to compute the eclipses itself, not to draw from a table; so while your code will be useful to folks who need it in the meantime, it's not how I expect the Skyfield internals will ultimately look. |
I'll have a crack at it... |
I've had a bash at calculating lunar/solar eclipse date/time. Outstanding is determining the eclipse type...need help with that one. See code below; free to use in Skyfield or otherwise.
|
@Bernmeister — Thanks for sharing your work, I’ll read this over! Did you happen to see the commit listed just above your comment? There is now a lunar eclipse routine in Skyfield. You’re welcome to try it out before the next release with:
Here are a few thoughts, looking at your code for the first time:
I am planning on releasing Skyfield in the next couple of days, with the new lunar eclipse logic you can see in the commit above, but without solar eclipse logic yet — that’s in the next section of the book I have, and I haven’t had time to write it up yet. Did you write the code above yourself from a book, or were you able to cut and paste it from the GitHub projects you link to? |
Only noticed it after you've pointed it out...oh well.
No idea how the calculation works under the covers. Did my best to "understand" the underlying algorithm, but ultimately, I just implemented things as best as I could and verified the final answer of eclipse date/time rather than verifying the algorithm itself. When it came to the eclipse type (from Meeus) I found the description (differences between solar and lunar eclipse types) ambiguous and confusing at best (fault is on my part, not Meeus).
All code written by me but based exclusively on Meeus (the Duffett-Smith/Zwart book was used for the Julian stuff). I tried to find existing code to verify results and/or help me understand the algorithm but in the end, I wrote code to implement the formulae in the book(s). |
If you were following the issue but GitHub didn‘t light up your notifications, I'll be happy in the future to make a comment after a commit to try to draw attention to it.
My approach with the commit above was similar: reading, followed by just converting their formulae into Python, with a focus on getting the right answer rather than understanding immediately. 🙂 Only once it worked did I review the text, figure out what the symbols meant, and substituted in some cases meaningful names for what had been plain variables in the original formulae. Hopefully your code helps other folks who need eclipse data before solar eclipses are implemented in Skyfield, which probably won’t be for a few weeks, even if I put it at the front of my to-do list! My guess is that it would be hard to incorporate into official Skyfield code, because I think many of those equations are approximations for things Skyfield does at high precision, like TDB time, and the Sun and Moon positions — but to untangle which are which, we would need to hunt down the source of all of the coefficients in your example code. Of which, wow, there are a lot! You did a lot of work to successfully bring them into Python, and I'm glad for the moment that they provide a good match for at least the times of both lunar and solar eclipses. |
In preparation of the 2024-04-08 eclipse, I've written some code utilizing Skyfield for calculating the Besselian elements for general and local eclipse circumstances as described in the well known Explanatory supplement by Urban and Seidelmann. For example accurate calculation of contact times for a fixed location works well. Using Skyfield, it's easy and fast to accurately calculate the actual elements as functions of time, no need for the usual polynomial tables. After this years eclipse, I expect to be diving into even more calculations like shadow path calculations and also more general searching of eclipse occurrences. So just asking, what is the status of the solar eclipse calculations, and would the formulae I've implemented be useful here? |
@lkangas — I would be interested in seeing your approach. All that I myself have had time to do can be seen in this file in the repository: https://github.com/skyfielders/python-skyfield/blob/master/design/solar_eclipse.py As you can see from the resulting image: — all that I've managed to do so far is the bare-bones step of drawing the path of the shadow across the surface. As yet there is no work on things like size of the shadow, length of totality, or percent-sun-covered for areas outside of totality. I haven't yet decided which code to write first: whether to work further on solar eclipses right now, or whether to take the routine I just wrote |
Roger, once the eclipse is over, I will put together some proof of concept and share it! Line-ellipsoid intersection is surely useful in general. For solar eclipses specifically, using Bessel's approach with a fundamental plane perpendicular to the shadow axis makes everything super easy. The intersection is found simply by applying two rotation matrices, and converting geodetic latitude into geocentric latitude. The local circumstances (contact times, umbral duration, percent coverage, etc) are also best carried out using the Besselian elements. I found that Skyfields find_discrete and find_minima work excellent for these purposes. I would also suppose that the generation of Besselian elements themselves would be interesting for almanac applications. |
I noticed in the file
TODO.rst
adding the functionality for lunar/solar eclipses.I am not sure if you intend to calculate this information or rather draw from a table. For what it's worth, below is a code sample I use in my application to extract eclipse information from tables I took from NASA. If any of the code is useful, please use it in Skyfield.
The text was updated successfully, but these errors were encountered: