<p>The text is trying to suggest that you do <code>ra._degrees</code>. How could the message be phrased better to make clear that the suggestion is to change the attribute name you are asking for from <code>.degrees</code> to <code>._degrees</code>? Would a leading <code>.</code> in front of the name help?</p>

CC BY-SA 4.0
2021-02-19T17:17:15.563Z
By convention, single underscores indicate that the attribute is intended as internal/private variable (https://dbader.org/blog/meaning-of-underscores-in-python). So end users shouldn't be using these in general. Also re the original Q comments: for converting radians to degrees, better to use `math.degrees()` or `numpy.degrees()` rather than hand-rolling the conversion.
astrosnapper
CC BY-SA 4.0
2021-02-19T21:12:02.147Z
I would never use `._degrees` for exactly the reason astrosnapper points out. As a user I assume the underscore indicating "semi-privateness" is there for a reason; perhaps it won't work as expected now, or in the future, or may disappear later, or something else...
uhoh
CC BY-SA 4.0
2021-02-19T21:15:39.180Z
@astrosnapper yes indeed, I've deleted that and pointed here.
uhoh
CC BY-SA 4.0
2021-02-20T08:58:35.333Z
@astrosnapper and @uhoh — Thank you for explaining your reluctance to follow Skyfield’s guidance in this case! I’ll go design a replacement name. (Originally I considered `.degrees_dammit` but that didn’t feel professional, so I tried the simple leading underscore, like Python’s own `namedtuple` uses for several methods that it invites users to call.) While I could also simply remove the restriction, my experience with an older library (PyEphem) suggests that letting users say `ra.degrees` without a warning message would lead to lots of confused users and user questions.
Brandon Rhodes
CC BY-SA 4.0
2021-02-20T09:43:53.877Z
(Any advice on the name? It was apparently `.degrees_anyway` until July 2014 when, while Skyfield was still pre-1.0, I switched to the plain underscore.)
Brandon Rhodes
CC BY-SA 4.0
2021-03-21T22:58:48.677Z
@BrandonRhodes I'm confused; there are `.km` and `.au` for positions, why is there reluctance for `.degrees` and `.radians`? Why might these, without a warning message, lead to lots of confused users and user questions? What would be confusing for angles that wouldn't be for the distances? Did this happen? Or is it the archetypal [everyuser](https://en.wikipedia.org/wiki/Everyman) generated by a benevolent developer working tirelessly to make the coolest most powerful and yet simultaneously easy-to-use python package in the universe that is imagined to get confused and generates questions? :-)
uhoh
CC BY-SA 4.0
2021-03-25T14:34:25.850Z
@uhoh — It was not, alas, a "generated" user, but actual PyEphem users (see my comment above) who I remember being repeatedly confused and choosing the wrong units for RA and then needing to ask for help. But maybe Skyfield's much better design, which tries to make users name the units they use to both set and get angles, by itself eliminates most of the problem? That possibility is making me lean at this point toward simply eliminating the checks. Alas, if the support load jumps, I'll have done permanent damage I can't ever undo. But if it works Skyfield will be simpler.
Brandon Rhodes
CC BY-SA 4.0
2021-02-19T16:32:32.277Z
2021-02-19T16:32:32.277Z
Brandon Rhodes
<p>Using the Python package <a href="https://rhodesmill.org/skyfield/" rel="nofollow noreferrer">Skyfield</a> I thought that I could get the RA expressed in degrees simply by doing ra.degrees, but I get the following message</p>
<blockquote>
<p>this angle is usually expressed in hours, not degrees; if you want to use degrees anyway, then please use the attribute <code>_degrees</code></p>
</blockquote>
<p>I tried a few things, but cannot find a solution. Could anyone help me?</p>

CC BY-SA 4.0
2021-02-19T16:31:01.543Z
I run v1.37, Python 3.27. I used your trick and it worked. Thanks.
Cirédérf Eniomel
CC BY-SA 4.0
2021-02-19T21:13:26.927Z
See [astrosnapper's comment](https://astronomy.stackexchange.com/questions/41556/ra-expressed-in-degrees?noredirect=1#comment85118_41561); better not use my trick (I've deleted it) but use one of those instead.
uhoh
CC BY-SA 4.0
2021-02-19T23:00:11.870Z
Or use `ra.hours * 15.0`... ? Seems a weird flex on the part of `Skyfield` to not let you use certain, perfectly valid units  - the use of RA and Dec in decimal degrees is becoming much more common
astrosnapper
<python><units><skyfield>
RA expressed in degrees
Cirédérf Eniomel
# RA expressed in degrees

(Asked by: username_0 on 2021-02-19)

Using the Python package [Skyfield](https://rhodesmill.org/skyfield/) I thought that I could get the RA expressed in degrees simply by doing ra.degrees, but I get the following message

> this angle is usually expressed in hours, not degrees; if you want to use degrees anyway, then please use the attribute `_degrees`

I tried a few things, but cannot find a solution. Could anyone help me?

**Tags:** python, units, skyfield
> **Comments:**
> **username_0**: I run v1.37, Python 3.27. I used your trick and it worked. Thanks.  
> **username_1**: See [astrosnapper's comment](https://astronomy.stackexchange.com/questions/41556/ra-expressed-in-degrees?noredirect=1#comment85118_41561); better not use my trick (I've deleted it) but use one of those instead.  
> **username_2**: Or use `ra.hours * 15.0`... ? Seems a weird flex on the part of `Skyfield` to not let you use certain, perfectly valid units  - the use of RA and Dec in decimal degrees is becoming much more common  

---

## 1 answers

### Answer by username_3 on 2021-02-19. Score: 2

The text is trying to suggest that you do `ra._degrees`. How could the message be phrased better to make clear that the suggestion is to change the attribute name you are asking for from `.degrees` to `._degrees`? Would a leading `.` in front of the name help?

> **Comments:**
> **username_2**: By convention, single underscores indicate that the attribute is intended as internal/private variable (https://dbader.org/blog/meaning-of-underscores-in-python). So end users shouldn't be using these in general. Also re the original Q comments: for converting radians to degrees, better to use `math.degrees()` or `numpy.degrees()` rather than hand-rolling the conversion.  
> **username_1**: I would never use `._degrees` for exactly the reason astrosnapper points out. As a user I assume the underscore indicating "semi-privateness" is there for a reason; perhaps it won't work as expected now, or in the future, or may disappear later, or something else...  
> **username_1**: @astrosnapper yes indeed, I've deleted that and pointed here.  
> **username_3**: @astrosnapper and @uhoh — Thank you for explaining your reluctance to follow Skyfield’s guidance in this case! I’ll go design a replacement name. (Originally I considered `.degrees_dammit` but that didn’t feel professional, so I tried the simple leading underscore, like Python’s own `namedtuple` uses for several methods that it invites users to call.) While I could also simply remove the restriction, my experience with an older library (PyEphem) suggests that letting users say `ra.degrees` without a warning message would lead to lots of confused users and user questions.  
> **username_3**: (Any advice on the name? It was apparently `.degrees_anyway` until July 2014 when, while Skyfield was still pre-1.0, I switched to the plain underscore.)  
> **username_1**: @BrandonRhodes I'm confused; there are `.km` and `.au` for positions, why is there reluctance for `.degrees` and `.radians`? Why might these, without a warning message, lead to lots of confused users and user questions? What would be confusing for angles that wouldn't be for the distances? Did this happen? Or is it the archetypal [everyuser](https://en.wikipedia.org/wiki/Everyman) generated by a benevolent developer working tirelessly to make the coolest most powerful and yet simultaneously easy-to-use python package in the universe that is imagined to get confused and generates questions? :-)  
> **username_3**: @uhoh — It was not, alas, a "generated" user, but actual PyEphem users (see my comment above) who I remember being repeatedly confused and choosing the wrong units for RA and then needing to ask for help. But maybe Skyfield's much better design, which tries to make users name the units they use to both set and get angles, by itself eliminates most of the problem? That possibility is making me lean at this point toward simply eliminating the checks. Alas, if the support load jumps, I'll have done permanent damage I can't ever undo. But if it works Skyfield will be simpler.  

---

