RA HMS string formatting is wrong?
See original GitHub issuehttp://docs.astropy.org/en/latest/coordinates/formatting.html
>>> from astropy.coordinates import ICRS
>>> from astropy import units as u
>>> c = ICRS(187.70592*u.degree, 12.39112*u.degree)
>>> str(c.ra) + ' ' + str(c.dec)
'187d42m21.312s 12d23m28.032s'
@hcferguson stated that it should be ‘h’ for RA and not ‘d’?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Source code for gammapy.catalog.utils
Returns ------- strrepr : str or list of strings IAU format string ... and formatted # instead of formatting floats directly ra_h =...
Read more >How to convert an H:MM:SS time string to seconds in Python?
I have a string in the format H:MM:SS (always 2 digits for minutes and seconds), and I need the integer number of seconds...
Read more >Astronomical Coordinate Systems (astropy.coordinates)
Once you have a coordinate object you can access the components of that coordinate (e.g., RA, Dec) to get string representations of the...
Read more >Astronomical Coordinate Systems (astropy.coordinates)
c = SkyCoord(ra=10.68458*u.degree, dec=41.26917*u.degree) >>> c.ra ... For more control over the string formatting, use the to_string method of the ...
Read more >Python String Formatting Best Practices
#2 “New Style” String Formatting ( str.format ) ; 'Hello, {}'.format(name) 'Hello, Bob' ; 'Hey {name}, there is a 0x{errno:x} error!'.format( ... name=name,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pllim > Anyways, yeah, I didn’t know I can format it in the other way. Thanks, @bsipocz !
string parsing leaves you some kind of PTSD so it’s easier to remember 😉
I think we can close this, because the formatting isn’t “wrong”: it was a design decision to use the input unit, and not assume a default because astronomers have different wants and needs (case in point: @mhvk prefers hours, I prefer degrees 😄).
But the 2nd point @mhvk raised is fair, and we’ve been meaning to lighten the assumptions made about units (see #6184)!