question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RA HMS string formatting is wrong?

See original GitHub issue

http://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:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bsipoczcommented, Apr 17, 2019

@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 😉

1reaction
adrncommented, Apr 17, 2019

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)!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found