Anonymous RU
Anonymous RU

Reputation: 54

Print coordinates (Astropy)

From the Astropy documentation, this example is given:

c = SkyCoord('00h42m30s', '+41d12m00s')

when print(c) is given you get

<SkyCoord (ICRS): (ra, dec) in deg (10.625, 41.2)>

but what if I want to have an output like "the right ascension is 10.625 and the declination is 41.2"?

My initial thought was that I could just use c[0] and c[1] but it seems that it's not indexable, any tips?

Upvotes: 0

Views: 463

Answers (1)

Iguananaut
Iguananaut

Reputation: 23346

I'm not sure I understand the problem. Did you try

>>> c = SkyCoord('00h42m30s', '+41d12m00s')
>>> print(f'the right ascention is {c.ra.value:0.3f} and the declination is {c.dec.value:0.2f}')
the right ascention is 10.625 and the declination is 41.20

Upvotes: 2

Related Questions