Why was the decision made for the observers lat/lon numeric values to be treated as radians but string values to be treated as decimal degrees?
When dealing with lat / lon values in Python I usually deal with floats objects. If the stars are aligned right, there may be an int object or two floating in there but mostly floats. I always end up naively writing some code like this:
lat = 0.0
lon = 0.0
observer = ephem.Observer()
observer.lat = lat
observer.lon = lon
# etc... etc...
And then, I get burned. I get burned because my lat / lon values are in decimal degrees, not radians. It is usually bad because I end up scratching my head wondering what i've done wrong. In the end, I end up converting to radians. Now theoretically, I could do this to get the right result:
observer = ephem.Observer()
observer.lat = str(lat)
observer.lon = str(lon)
But that seems wonky also, I thought my values had to be in radians! Oh wait, only if it's a float. I understand accepting string or float objects is nice but accepting different numeric types based on the python types seems inconsistent. I would expect both assignments to take the same numeric types, like this:
lat = lon = 0.55
observer.lat = lat # float lat is assumed to be in radians
observer.lon = lon # float lon is assumed to be in radians
lat = lon = '0.55'
observer.lat = lat # string lat is assumed to be in radians
observer.lon = lon # string lon is assumed to be in radians
Then conversion operators could be provided for decimal degrees / dms:
lat = '25.0'
lon = 25.0
observer.lat = ephem.to_rad(lat)
observer.lon = ephem.to_rad(lon)
Then the to_rad function would explicitly assume that decimal degrees were being provided as either a float or string object. At this point, the interfaces would be consistent. I very briefly dug through _libastro.c and looked into the to_angle function, which lies at the core of this question.
I can not think of a good reason to not implement this. In fact, I will volunteer to do it! But before I go gun-ho on this, I know that i'm not a libastro / pyephem expert, so I wanted to open this question up to make sure this makes sense. It is entirely possible that this was done for very good reason and i'm just hopelessly confused.
If experienced users or someone familiar with the core of the software could comment, I would greatly appreciate it.
Thank You in advance!