Skip to content

Commit

Permalink
When dealing with ephemeris, always provide in UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
akoumjian committed Aug 1, 2024
1 parent 1988db5 commit ac69b6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/adam_core/orbits/query/horizons.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,14 @@ def query_horizons_ephemeris(
ignore_index=True,
)

# Horizons produces UTC but we use tdb everywhere
epochs = Timestamp.from_jd(pa.array(dfs["datetime_jd"]), scale="utc").rescale("tdb")

ephemeris = Ephemeris.from_kwargs(
orbit_id=dfs["orbit_id"],
object_id=dfs["targetname"],
# Convert from minutes to days
light_time=dfs["lighttime"] / 1440,
alpha=dfs["alpha"],
coordinates=SphericalCoordinates.from_kwargs(
time=epochs,
time=Timestamp.from_jd(pa.array(dfs["datetime_jd"]), scale="utc"),
lon=dfs["RA"],
lat=dfs["DEC"],
origin=Origin.from_kwargs(code=dfs["observatory_code"]),
Expand Down
6 changes: 6 additions & 0 deletions src/adam_core/propagator/propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ def _generate_ephemeris(
spherical_coordinates, SphericalCoordinates, frame_out="equatorial"
)

# Ephemeris are generally compared in UTC, so rescale the time
spherical_coordinates = spherical_coordinates.set_column(
"time",
spherical_coordinates.time.rescale("utc"),
)

if isinstance(orbits, Orbits):

ephemeris = Ephemeris.from_kwargs(
Expand Down

0 comments on commit ac69b6a

Please sign in to comment.