[AstroPy] Constructing Angle from a tuple specified as sign string plus numbers for degrees, arcmin, arcsec

Erik Bray embray at stsci.edu
Tue Aug 11 10:22:18 EDT 2015

On 08/10/2015 11:13 PM, Eric Jensen wrote:
> Hi all,
> Thanks for the suggestions.  These solutions both have the problem that I
> suspect the original table formatting was designed to avoid, which is the
> infamous “minus zero” problem, affecting declinations between 0 and -1
> degrees.  For those decs, the leading part of the coordinate is “-00” which
> is fine as a string, but doesn’t preserve sign when evaluated as an integer:
> In [1]: x = '-00'
> In [2]: print int(x) 0
> In [3]: print int(x) < 0 False

Ah, right.  In my original suggestion I should have suggested float() instead of 
int().  IEEE floating point has distinct values for +0 and -0, and I believe the 
coordinates package can tell the difference between the two.

(Or so I thought, but after trying it out it appears not:

In [11]: Angle((-0.0, 0, 0), unit='deg').signed_dms
Out[11]: signed_dms_tuple(sign=0.0, d=0.0, m=0.0, s=0.0)


So maybe that should be fixed?  Or maybe this has already been discussed and 
rejected.  It does have the obvious problem that it only works if you explicitly 
use a floating point value for the degrees.


More information about the AstroPy mailing list