Repository navigation
dms declinations with -00 not treated correctly - #875
Merged
Merged
Conversation
Member
|
This is a pretty bad bug, and should be fixed for 0.2.1 IMHO. I'll take a quick look now. |
Member
|
Hm. I could've sworn there was something in there for dealing with -0, but I might be thinking of the formatting code, not the parsing code. |
…itive. The issue is that while float('-00') returns a negative zero, int('-00') does not, so we need to take care of always using float rather than int when converting degrees or hours to numerical values.
Member
|
Fixed in the attached code - let's check Travis passes. |
Member
|
The output for the original code in the issue is now: |
Member
|
I thought this was fixed too, although I also may be confusing it with output. Anyway, this looks good to merge to me (Assuming tests pass). |
Member
|
I'm g oing to wait for the tests to pass on this, then I will merge it and do the release. |
Member
|
@iguananaut - there's a failure in the docs build related to |
embray
added a commit
that referenced
this pull request
Apr 3, 2013
dms declinations with -00 not treated correctly
embray
added a commit
that referenced
this pull request
Apr 3, 2013
embray
added a commit
that referenced
this pull request
Apr 3, 2013
dms declinations with -00 not treated correctly
embray
added a commit
that referenced
this pull request
Apr 3, 2013
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When parsing declinations from dms strings, astropy.coordinates doesn't deal with "-00" correctly. For example:
In [56]: print coord.Dec('00 30 00.0', unit=units.degree)
0d30m00.00000s
In [57]: print coord.Dec('01 30 00.0', unit=units.degree)
1d30m00.00000s
In [58]: print coord.Dec('-00 30 00.0', unit=units.degree)
0d30m00.00000s
In [59]: print coord.Dec('-01 30 00.0', unit=units.degree)
-1d30m00.00000s
The third output should be '-0d30m00.00000s', with a minus sign. The underlying problem is that the degrees string is converted to an integer before checking for a minus sign, so '00' and '-00' become the same thing.