skyfielders / python-skyfield

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

How do I get the constellation position of a planet in Skyfield? #228

Closed HelioGiroto closed 4 years ago

HelioGiroto commented 5 years ago

Dear Brandon,

I'd like to get a result like this example in PyEphem:

print(ephem.constellation(ephem.Jupiter('2017/9/22'))) Result: ('Vir', 'Virgo')

Is it possible in SKYFIELD??

Thank you!!!

IN SPANISH:

Estimado Brandon,

Me gustaria obtener un resultado tal como en este ejemplo en PyEphem:

print(ephem.constellation(ephem.Jupiter('2017/9/22'))) Result: ('Vir', 'Virgo')

¿Es eso posible en SKYFIELD?

Muchas Gracias

brandon-rhodes commented 5 years ago

Good question! Skyfield does not yet have a table of constellation positions in it. I'll leave this issue open until I or someone else has time to add it. Thanks for the idea!

HelioGiroto commented 5 years ago

Thank you Brandon!! Don't forget it, please!!! I really admire your work in programming! And I use your modules a lot... Good job!!

ghost commented 5 years ago

The easiest way to do this is to use the precessed constellation boundary lines from the IAU: https://www.iau.org/public/themes/constellations/

If you don't want to download the TXT files individually, I've glued them together at: https://github.com/barrycarter/bcapps/tree/master/ASTRO/CONSTELLATIONS/iau-all-constellations.txt.bz2

A possibly more accurate way is to precess position back to B1875.0 and use the original boundaries: http://pbarbier.com/constellations/boundaries.html

http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42 provides C and FORTRAN programs to determine the constellation for a given stellar location.

As a note, not even the CSPICE libraries will return a constellation, although HORIZONS will.

EDIT: pyephem appears to have this functionality inherited from libastro: pyephem-master/libastro-3.7.5/constel.c (for example)

brandon-rhodes commented 5 years ago

Yes, precession is indeed necessary when doing the computation. It should be fairly easy to code up as soon as someone gets to it!