skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.43k stars 213 forks source link

Method to access lunar libration data present in the ephemerides #80

Closed davidmikolas closed 4 years ago

davidmikolas commented 8 years ago

This has been separated from #79 since it only requires data which is already present in (most of) the ephemerides.

To generate a view of the disk of the moon from earth (not only the position), the libration data in the ephemerides is useful.

Is it possible to access that now through Skyfield? If not, a new method would be helpful - possibly something like body.at().position.libration() or body.at().libration(), giving an error when body isn't the moon [301].

In the mean time: - is the major contribution to the libration just the difference between the steady rotation of the moon and the non-steady increase in true anomaly due to the elliptical orbit? If so, I can approximate the libration for short periods of time just using geometry and a rotation period.

brandon-rhodes commented 8 years ago

I should start by taking a look at the data — do you have an example of a recent ephemeris that includes libration that you would like me to take a look at in particular?

davidmikolas commented 8 years ago

Here's where I am at the moment. I haven't actually seen the lunar libration information inside an ephemeris, here's why I thought it was present in DE405 and possibly others.

I'm not certain, but it seems to me that "lunar libration" can apply to two different things:

Apparent librations (Wikipedia):

  1. steady lunar rotation but variable true anomaly due to eccentricity
  2. tilt between lunar rotation axis and normal of lunar orbital plane
  3. daily geometrical effects as the earths's rotation moves the observer from one side of the earth-moon line to the other.

"Another" type of libration (not certain about this):

  1. due to tidal/torque effects, the moon's rotation may have a small, periodic variation in rate

IOM 312.F-98-048 (Standish 1998): ftp://ssd.jpl.nasa.gov/pub/eph/planets/ioms/de405.iom.pdf Reading through section VII, it mentions that one of the differences between DE405 and DE406 is that for the latter, for file size reasons, librations have been separated out and saved to a separate file.

A document I call Chapter 8 (Standish and Williams, date ?) ftp://ssd.jpl.nasa.gov/pub/eph/planets/ioms/ExplSupplChap8.pdf discusses treatment of lunar shape and torque effects at length. I had thought that it said somewhere that librations were included in the ephemeris, but reading again, I don't see it.

Searching this page http://ssd.jpl.nasa.gov/?planet_eph_export for the word libration lights up most of the DEs descriptions, including DE405. If I click on the link for ASCII information, it takes me to here: ftp://ssd.jpl.nasa.gov/pub/eph/planets/ascii/ascii_format.txt where 15 triples are listed. Number 13 and 14 appear to be what I'm after.

   Mercury
   Venus
   Earth-Moon barycenter
   Mars 
   Jupiter 
   Saturn
   Uranus
   Neptune
   Pluto
   Moon (geocentric)
   Sun
   Earth Nutations in longitude and obliquity (IAU 1980 model)
   Lunar mantle libration
   Lunar mantle angular velocity
   TT-TDB (at geocenter)
brandon-rhodes commented 8 years ago

It looks like we will have to teach jplephem about a new kind of DAF file with a segment format that it is unfamiliar with, if we are to teach it to read libration files. It looks like the libration files are described here:

http://naif.jpl.nasa.gov/naif/lunar_kernels.txt

And live here:

http://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/

And the formatting and math that needs to happen inside of jplephem lives here:

http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/pck.html

I am not sure that I have time to tackle this immediately, but I will leave this issue open and these links here until sometime when I or someone else interested in contributing to the project can tackle it.

Thanks for pointing out the omission, and hopefully we can get this added!

davidmikolas commented 8 years ago

Thank you for tracking all of that down!

It looks like there is a lot there - possibly rotation of other planets as well. I think there's one or two other issues here that may be related to that - e.g. topos() of other solid planets.

So I'm going to look around a little. I downloaded your de421 package from pypi, unzipped it, and there is a jpl-librations.npy in there that looks interesting. I'll let you know what I find. Right now I don't need to integrate into Skyfield, just want see the numbers.

The links above are really helpful, thanks again!

image image

davidmikolas commented 7 years ago

I think I will look into this again. Skyfield has matured so much in the last year and a half, this may be easier to implement than before. Of course that doesn't mean it's "easy" yet.

brandon-rhodes commented 4 years ago

I've just added a section on libration to the docs, and the ability to calculate it easily should appear soon when the next version of Skyfield is released. Thanks for the idea!

Meanwhile, feel free to copy and paste ideas from the above-linked diff into your own code if you want to do the computation manually instead of waiting for the new method to appear.