skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.41k stars 211 forks source link

Lunar (and others) Topos Coordinates #124

Closed hphilli5 closed 4 years ago

hphilli5 commented 7 years ago

I have been using the Topos feature to calculate a rotation matrix from ICRS to an earth-centered, earth-fixed coordinate frame using the following method:

1) Pull position of earth center referenced from solar system barycenter 2) Pull position from solar system barycenter to 0 deg latitude, 0 deg longitude, 0 meter elevation. This is where the ECEF x axis would pierce the geoid 3) Subtract #1 from #2 and calculate the unit vector of that. This is the unit vector of an ECEF x axis. 4) Repeat 2) and 3) but for 90 deg latitude, 0 meter elevation (any longitude). This is the unit vector of an ECEF z axis. 5) Take the cross product of ECEF z axis and ECEF x axis (in that order). This is the unit vector of an ECEF y axis. 6) Steps 3-5 provide what is necessary to calculate a direction cosines matrix from ECEF to ICRS and vice versa (at a specific epoch)

I would like to be able to do the same thing for the lunar orientation (equatorial plane). Does this capability already exist and I'm overlooking? It appears that I can specify 'center' and 'center_name' with Topos, but it ends up just assuming earth-centered.

Thanks for creation and continued development of this awesome tool.

davidmikolas commented 7 years ago

related: Generate topos for body other than Earth #79 and also Method to access lunar libration data present in the ephemerides #80, I can't be of much help, but it is good to know there is interest!

brandon-rhodes commented 6 years ago

(Catching up, now that PyCon is over!)

No, Skyfield doesn't currently have a model of the Moon as a spheroid, nor any routines for understanding the JPL data files that might provide those data. I'd welcome contributions that start adding such capabilities but might not get to them myself for at least another few years.

As for generating your rotation matrix: am I correct that you're looking for something like the matrix computed near the bottom of terra() in earthlib.py, but with latitude and longitude set to zero? If so, then maybe we could come up with a way of exposing that matrix instead of having it thrown away when terra() is done with its computation. Take a look, and let me know what you think!

tcz commented 5 years ago

Hi @brandon-rhodes, While I feel unable to perform this contribution, I'd be happy to reward your time spent on this with money if you are up for this.

brandon-rhodes commented 5 years ago

@tcz I am definitely busy for the next 2 weeks, but am hoping to have more time for progress on Skyfield after that. You are interested in Skyfield being able to accept the lunar longitude and latitude of a spot on the lunar surface, and to return altitude+azimuth coordinates for objects above the horizon from that spot on the Moon?

tcz commented 5 years ago

That's exactly right!

davidmikolas commented 5 years ago

as am I: Generate topos for body other than Earth #79 and also: Method to access lunar libration data present in the ephemerides #80

brandon-rhodes commented 4 years ago

I have just released Skyfield 1.16 which implements support for lunar latitude/longitude locations. Try it out, and let me know if you run into any snags or problems with the implementation!

https://rhodesmill.org/skyfield/planetary.html

It wound up taking about two weeks of half-time work, more than I was expecting, to get the coordinates to finally all agree! @tcz, if this came in time to be of any help to you, let me know if I should set up a Patreon or something to enable a donation. :)

tcz commented 4 years ago

Hey Brandon, it's amazing thanks! We'll try it out! For God's sake please art up a patreon!!

On Fri, 20 Dec 2019 at 19:25, Brandon Rhodes notifications@github.com wrote:

Closed #124 https://github.com/skyfielders/python-skyfield/issues/124.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/skyfielders/python-skyfield/issues/124?email_source=notifications&email_token=AABHCCA7UBHPYHXCM5RDZATQZUEYXA5CNFSM4DFFQU3KYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOVTZUEBI#event-2901623301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABHCCGIGD2AEH4CQFOQLL3QZUEYXANCNFSM4DFFQU3A .

brandon-rhodes commented 4 years ago

@tcz — The review process took several weeks, but at your suggestion I have joined the GitHub sponsors program! There should now be a “Sponsor” link at the top of this page.

This is my first time trying to set up contribution levels and draft their descriptions. Whether you opt at this point to sponsor or not (it’s been 7 months, so you might of course have moved on to other projects!), if you have any advice about what levels would work best from the point of view of a potential sponsor, I would welcome an email with ideas about how to improve them. Thanks!