Using pyEphem to calculate moon phase for a certain location: cannot get it to work correctly

204 Views Asked by At

I would like to know the moon phase at a certain location at a certain date. For example, let's take Makassar in Indonesia, on the 27 August 2018.

I have the following script, from this page:

import ephem

# Define the observer's location
observer = ephem.Observer()
observer.lat = '-5.156276'
observer.long = '119.434574 '
    
# Define the date
observer.date = '2018/08/27'
 
# Define the moon
moon = ephem.Moon()
 
# Calculate the phase of the moon
moon.compute(observer)
 
# Print the phase of the moon
print(moon.moon_phase)

I get the result: 0.9968778436943431 which corresponds to very close to a new moon. But when I look it up on the web, the moon at this time in this location was a full moon. So I was expecting something close to 0.5.

Where is my mistake?

0

There are 0 best solutions below