Skip to content

Issue warning for (mis-)use of SkyCoord.separation with mixed frames #14812

@pmaxted

Description

@pmaxted

What is the problem this feature will solve?

The calculation of the separation of my target from the Moon was wrong despite the code looking reasonable and no warning being printed.

Here is an example of inconsistent target-moon separations being calculated ...

>>> from astropy.coordinates import SkyCoord, get_moon
>>> from astropy.time import Time
>>> target_coo = SkyCoord.from_name('Kelt-11')
>>> time = Time('2020-03-09T14:50:41',scale='utc',format='isot')
>>> moon_coo = get_moon(time)
>>> print(moon_coo.separation(target_coo).degree,target_coo.separation(moon_coo).degree)
20.63726192992106 15.98210433623633

The first value is correct, but it is far from obvious that the second why to calculate this value will not give the correct value for an observer at the geocentre.

Describe the desired outcome

A warning should be printed if SkyCoord.separation() is doing a coordinate transformation for one of the coordinates due to inconsistent reference frames.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions