craftutils.observation.epoch.SkyCoord.transform_to(frame, merge_attributes=True)

Transform this coordinate to a new frame.

The precise frame transformed to depends on merge_attributes. If False, the destination frame is used exactly as passed in. But this is often not quite what one wants. E.g., suppose one wants to transform an ICRS coordinate that has an obstime attribute to FK4; in this case, one likely would want to use this information. Thus, the default for merge_attributes is True, in which the precedence is as follows: (1) explicitly set (i.e., non-default) values in the destination frame; (2) explicitly set values in the source; (3) default value in the destination frame.

Note that in either case, any explicitly set attributes on the source |SkyCoord| that are not part of the destination frame’s definition are kept (stored on the resulting |SkyCoord|), and thus one can round-trip (e.g., from FK4 to ICRS to FK4 without losing obstime).

Parameters

framestr, ~astropy.coordinates.BaseCoordinateFrame class or instance, or |SkyCoord| instance

The frame to transform this coordinate into. If a |SkyCoord|, the underlying frame is extracted, and all other information ignored.

merge_attributesbool, optional

Whether the default attributes in the destination frame are allowed to be overridden by explicitly set attributes in the source (see note above; default: True).

Returns

coord|SkyCoord|

A new object with this coordinate represented in the frame frame.

Raises

ValueError

If there is no possible transformation route.