PyEphem reporting different latitude and longitude than input values
Question: I have used Pyephem to calculate the latitude and longitude of the sun given
date, latitude and longitude of an observer at sea level. I get results I do
not understand. The code I ran follows (on Ipython notebook in windows 7):

    
    
    import ephem
    date = '2015-04-17 12:30:00'
    
    Amundsen = ephem.Observer()
    Amundsen.lat = '46.8'
    Amundsen.lon = '-71.2'
    Amundsen.date = date
    
    sun = ephem.Sun(Amundsen)
    sun.compute(Amundsen)
    
    print Amundsen
    print "sun latitude: {0}, sun longitude: {1}".format(sun.hlat,sun.hlon)
    

The resulst I obtained are the following:

    
    
    <ephem.Observer date='2015/4/17 12:30:00' epoch='2000/1/1 12:00:00'lon='-71:12:00.0' lat='46:48:00.0' elevation=0.0m horizon=0:00:00.0 temp=15.0C pressure=1010.0mBar>
    sun latitude: -0:00:00.1, sun longitude: 207:11:10.2
    

As you can see, when printing the input data, the latitude and the longitude
of my obesrver have been changed from 46.8 and -71.2 to 46.48 to -71.12. This
is maybe a basic fact, but why does this happen? and how to correct for it?

Thanks in advance,

Grégory


Answer: The values, happily, are not changing. You have entered them as decimals with
a decimal point `.` separating each degree into ten tenths, but that is not
how longitude and latitude are traditionally expressed — they are usually
written as a whole number, then sixtieths called “minutes” and then sixtieths-
of-sixtieths called “seconds” which PyEphem separates with the `:` character.

So `46:48` means “46 degrees 48 minutes latitude” because 48/60 = 0.8.

The `libsastro` use of `:` is a compromise to the limitations of ASCII.
Traditionally, degrees minutes and seconds would be delimited with a degree
symbol, a prime, and a double prime, which is now possible in Unicode but not
widespread in programming languages:

46°48′00″

I note that in the academic papers of Bernard R. Goldstein, on the astronomy
of the late Middle Ages and Renaissance, that an academic notation using a
semicolon for the decimal point and a comma between the minutes and seconds is
used, that looks like:

46;48,00°

