Orbit.from_body_ephem returns wrong orbit for the Moon #382
Comments
I will provide a short term fix for this next week, after the beta release. |
http://docs.astropy.org/en/stable/api/astropy.coordinates.get_body_barycentric_posvel.html
Here, it is writter that we can not calculate the velocity of Moon using |
The documentation of Astropy is incorrect at that point: it cannot be computed with the
|
So, okay, only changing the ICRS to GCRS will work? As the velocity we get it also in the frame of Sun. Converting it to the frame of Earth is probably not a trivial task? Or it is? Just subtracting two vectors? |
Yes, changing to ICRS to GCRS is all that's needed. You have examples of how to do that in two notebooks: |
Oh. This is amazing. I will do this! |
Fixed in #410. |
For the last release, porkchops for earth-moon gives the same error: I tried to fix by what was said above but the folders in question aren't the same and don't fix. Any solution? |
Hi @mourasftw! It should be fixed by setting the Astropy ephemerides to the JPL ones. Please open a new issue with more information about the code you're running. |
The method
Orbit.from_body_ephem
returns the wrong orbit for bodies not orbiting the Sun, in particular for the Moon:This is because
from_body_ephem
usesget_body_barycentric
, which returns ICRS coordinates, but then sets the.parent
to the Earth:poliastro/src/poliastro/twobody/orbit.py
Lines 166 to 167 in b659a94
At least for the bodies included in
poliastro.bodies
,Orbit.from_body_ephem
should always return a correct result.Setting the
.parent
to the Sun in the case of the Moon would be absurd, and give incorrect results for the propagation. Therefore, we have to look for other alternatives:get_body_barycentric
assumes bodies from the Solar System, so this would not even work for other bodies, unless a proper ephemerides is provided.Orbit
. This would increase the number of possible frames returned by poliastro to three: ICRS for most bodies, false ecliptic for NEOS, and GCRS for the Moon. Still, it's the only correct thing to do.In the long term, it's clear that we need strong coupling between
bodies
,Orbit.from_body_ephem
, and reference frames (see #257, #109).Addresses #<put issue number here>
The text was updated successfully, but these errors were encountered: