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