skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.39k stars 209 forks source link

An idea(?) for finding a solar eclipse #807

Open sgbmzm opened 1 year ago

sgbmzm commented 1 year ago

As far as I understand, there is still no official eclipse search option using Skyfield. An idea came to my mind, but I don't know if it is true. The principle is to use elongation including consideration of the geographical location.

Example:

from skyfield.api import load from skyfield.framelib import ecliptic_frame from skyfield.searchlib import find_maxima

eph = load('de440s.bsp')

The time of the eclipse record that was in 2017 in Illinois in the United States

time = load.timescale().utc(2017, 8, 21, 18, 26, 40)

I intentionally included the geographical position in the calculation, because it is very significant in a solar eclipse, and therefore I did not calculate according to the barycentric position.

bluffton = eph['earth'] + wgs84.latlon(40.197303, -89.626094 * E, elevation_m=0) # Illinois

sun = bluffton.at(time).observe(eph['sun']).apparent() moon = bluffton.at(time).observe(eph['moon']).apparent()

elongation_degrees = sun.separation_from(moon).degrees

elongation_degrees: 0.06390583824558749

0.0 This corresponds to a total solar eclipse because the Sun and the Moon are exactly on the same line towards the observer at this location. According to this, it is possible to Check what the exact elongation is when a partial solar eclipse begins.

This is my idea, and I would love to hear if it is a correct idea.

(Additionally, this method may also be used for a lunar eclipse, but I saw that there is already a method in Skyfield for a lunar eclipse.)

sgbmzm commented 1 year ago

Now I think, that the angular diameter of the sun and the moon should also be added to the solar eclipse calculation

sgbmzm commented 1 year ago

And of course it is necessary to check that the sun is above the horizon during the eclipse

(diameter of the sun and the moon will affect the nature of the eclipse, whether they will see a solar ring around the moon, or whether the sun will be completely hidden)

brandon-rhodes commented 1 year ago

Yes, you can indeed confirm whether a given location on Earth is seeing a solar eclipse by comping the angle between the Sun and Moon and seeing whether it’s less than the combined lengths of their visual radii!

But I suspect that what most people want is not confirmation, but a routine that given an eclipse, can find which latitude-longitude is at the center of totality. If I'm reading your code correctly, it has to know the latitude-longitude already?

sgbmzm commented 1 year ago

Right. I just wanted to search for my current location, within a certain number of years, when a solar eclipse will occur in my location. I do think this is very important information, at least when Skyfield doesn't have anything else about a solar eclipse.

If you want to check several geographic locations, it may be possible to start the search without including the geographic location, to get a general direction when an eclipse will occur, and then, in a second step, to do a repeated search on several geographic locations, in skips of several degrees of longitude and latitude, to make sure that they are indeed within the eclipse, and to know the direction of the eclipse's progress.

Another thing to think about is: what is the most correct step_days. Maybe it should be about every 27 days? Maybe start the search on a new moon, and from there on check every 27 days?

You need to check what is the minimum value of elongation at which a partial eclipse occurs, then check/print only such cases. And besides check when the elongation is 0.0 for a total eclipse.

I remembered all this because in the location of the future there will be a solar eclipse in the coming week.

Thanks, and sorry for the broken English (it's a Google translation)

sgbmzm commented 1 year ago

Today is the first time I tried to use find_minima(), and I have never tried to use find_discrete().

If you are looking for a complete eclipse, then maybe you should use find_discrete() on elongation 0.0 in a certain range of years. If you are looking for any partial eclipse, then maybe use () find_minima, in a certain range of years.

Do you think it would not interest people to be able to find an answer to the following questions:

  1. When will the next partial solar eclipse occur in my location?
  2. When was the last time a partial solar eclipse occurred in my location?
  3. When will the next total solar eclipse occur in my location?
  4. When was the last time a total solar eclipse occurred in my location? I think it's very interesting.
brandon-rhodes commented 1 year ago

I think, yes, people would enjoy an example in the manual showing how to get a list of solar eclipses, together with percent totality, that will occur at a given latitude-longitude between a given starting date and ending date.

sgbmzm commented 1 year ago

Thanks. Your examples are really fantastic. I am using your examples, making small changes. That's how I was able to do a lot of things, even before I understood how they worked.

cruisen commented 1 year ago

Just to repeat of what has been said, and maybe also some additional thoughts, and I hope this is the right place to discuss this...

General

Almanac of Solar eclipses

Localized Visibility of Solar Eclipses

Optimisations

My Questions