Skip to content

Inconsistent angle string unit in coordinates/angles gives incorrect errors / values #1387

Closed

Description

@taldcroft

In the 0.2.4 docs and code, this is seen:

>>> ICRSCoordinates('3d4m5s +6h7m8s', unit=(u.hour, u.degree))
ValueError: parse_hours: Invalid input string, can't parse to HMS. (3d4m5s)

In master one gets:

>>> ICRSCoordinates('3d4m5s +6h7m8s', unit=(u.hour, u.degree))
BoundsError: The angle(s) [ 5156.62015618  6016.05684887  6875.49354157] falls outside of the specified bounds (-5156.62015618, 5156.62015618) (in deg)

>>> ICRSCoordinates('0d0m0s +0h0m0s', unit=(u.hour, u.degree))
ValueError: Unknown format code 'f' for object of type 'str'

This may be related to this problem in Angle where giving an HMS string with unit=u.degree results in a length=3 array:

Angle('+6h7m8s', unit=u.degree)
<Angle [u'90d00m00.00000s' u'105d00m00.00000s' u'120d00m00.00000s']>

Activity

  1. mdboom commented on Aug 30, 2013

    @mdboom
    Contributor

    That last example is definitely wrong, and I thought it was covered by the tests. Let me look into that.

  2. mdboom commented on Sep 3, 2013

    @mdboom
    Contributor

    With #1388:

    In [4]: ICRSCoordinates('3d4m5s +6h7m8s', unit=(u.hour, u.degree))
    ERROR: BoundsError: The angle(s) 5258.79762964 falls outside of the specified bounds (-5156.62015618, 5156.62015618) (in deg) [astropy.coordinates.angles]
    

    I think that's a legit error.

    In [5]: ICRSCoordinates('3d4m5s +3h7m8s', unit=(u.hour, u.degree))                                                                                                                                     
    Out[5]: <ICRSCoordinates RA=3.06806 deg, Dec=46.78333 deg>
    

    And

    In [6]: ICRSCoordinates('0d0m0s +0h0m0s', unit=(u.hour, u.degree))
    Out[6]: <ICRSCoordinates RA=0.00000 deg, Dec=0.00000 deg>
    
  3. taldcroft commented on Sep 3, 2013

    @taldcroft
    MemberAuthor
    In [4]: ICRSCoordinates('3d4m5s +6h7m8s', unit=(u.hour, u.degree))
    ERROR: BoundsError: The angle(s) 5258.79762964 falls outside of the specified bounds (-5156.62015618, 5156.62015618) (in deg) [astropy.coordinates.angles]
    

    Agreed that 6h7m is outside of 90 degrees, but what the heck is with the angle of 5258.79 and bounds of +/-5156.62? I think that #1388 is good for merge, but that this issue #1387 should stay open until we resolve the above.

  4. mdboom commented on Sep 3, 2013

    @mdboom
    Contributor

    Oh, gee. Of course. Something is wrong with the unit of the error message, I suspect.

  5. added a commit that references this issue on Sep 3, 2013
  6. mdboom commented on Sep 3, 2013

    @mdboom
    Contributor

    The bug in the error message is actually gone in master, since #1310 was merged (and the error message happens in a completely different way). Rebasing #1387 fixed it.

  7. taldcroft commented on Sep 3, 2013

    @taldcroft
    MemberAuthor

    @mdboom - Excellent. So it looks like you are good to merge #1388 and close #1387, at least from my perspective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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