Some coordinate conversions (for example, ICRS -> ITRS) fail unexpectedly for zero-length arrays.
Expected behavior
Transformation should result in a new SkyCoord of object of the desired frame and with zero length.
How to Reproduce
>>> from astropy.coordinates import SkyCoord
>>> from astropy.time import Time
>>> from astropy import units as u
>>> s = SkyCoord([] * u.deg, [] * u.deg, obstime=Time([], format='iso'))
>>> s.galactic
<SkyCoord (Galactic): (l, b) in deg
[]>
>>> s.itrs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/sky_coordinate.py", line 896, in __getattr__
return self.transform_to(attr)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/sky_coordinate.py", line 704, in transform_to
new_coord = trans(self.frame, generic_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/transformations/composite.py", line 113, in __call__
curr_coord = t(curr_coord, curr_toframe)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/transformations/function.py", line 175, in __call__
return supcall(fromcoord, toframe)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/builtin_frames/icrs_cirs_transforms.py", line 34, in icrs_to_cirs
astrom = erfa_astrom.get().apco(cirs_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/erfa_astrom.py", line 54, in apco
xp, yp = get_polar_motion(obstime)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/astropy/coordinates/builtin_frames/utils.py", line 46, in get_polar_motion
xp, yp, status = iers_table.pm_xy(time, return_status=True)
^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
Ai, another case where a "smart" short-circuit caused problems: we special-cased size 0 and it doesn't always return the right number of elements. Fix in #17013...
Description
Some coordinate conversions (for example, ICRS -> ITRS) fail unexpectedly for zero-length arrays.
Expected behavior
Transformation should result in a new SkyCoord of object of the desired frame and with zero length.
How to Reproduce
Versions