I need to calculate the exact moon phase angle for each our of a day. I have my position in lat and long and a unix timestamp. At the end i would like to be able to caluculate the moon brightness with this formula: https://patents.google.com/patent/DE10113295A1

const moonPhaseAngle = Math.cos(( 2 * ( ( phase * 100 ) / 100 ) -1));

const moonBrightness = 10 * Math.sin( altitude ) * ( .5 + ( .5 * Math.cos( moonPhaseAngle ) ) );

This is my actual progress through web search. Thank you for helping me!

  • 1
    $\begingroup$ I suggest that you get the book "Astronomical Algorithms" by Jean Meeus in order to get the half dozen or so equations needed to calculate the phase angle. Note that the phase angle calculation can be performed without using the observer's location. $\endgroup$
    – JohnHoltz
    Oct 5 '19 at 3:14
  • $\begingroup$ @JohnHoltz You are correct because we consider the moon's official phase to be the phase for a theoretical geocentric observer. The moon is close enough that its position in the sky and thus its "actual" phase depends on the observer's location. The most obvious example is that a solar eclipse looks different in different parts of the world at the same time, and isn't even visible in some parts of the world. $\endgroup$
    – user21
    Oct 6 '19 at 15:03
  • $\begingroup$ Thank you for the responses! I have the observers position and calculate some values with the SunCalc Lib for JS. But I still can not get the angle ... $\endgroup$
    – JKortmann
    Oct 7 '19 at 9:10
  • $\begingroup$ Try using a library like pyephem or skyfield -- astronomy.stackexchange.com/questions/13488 may also help $\endgroup$
    – user21
    Oct 8 '19 at 0:16
  • $\begingroup$ I may add: the brightness is not simple geometric math alone. The scattered intensity varies by observation angle. Direct back-scatter as on full moon scatters a higher amount of light than at 90° scatter angle. The effect may not be gigantic, but definitely measurable. $\endgroup$ Jun 22 '20 at 22:43

I refer to the book : Astronomical Algorithms (Second Edition) by Jean Meeus.

  1. To calculate the values of position angle of the bright limb and position angle you will need to calculate the apparent RA and DEC of the Sun and the Moon.

  2. Code the equations for the Sun RA and DEC using Chapter 25. Please note that L0 (equ. 28.2) is in error To calculate T (Julian century you will need to compute Julian day (Chapter 7).

  3. Code equations for the Moon RA and Dec from the equations given in Chapter 47.

  4. For the calculation of Apparent RA and Dec you will need to compute Nutation and Obliquity - Equations in Chapter 22.

BTW. For all my calculations I have "standardized" on using the equations on page 144 for the variables : D, M, Mdash, F, and Omega. Fyi compare the equations for M given in this book ie. equations 25.2 and 47.3

  1. Chapter 48 provides a formula (48.1) for the illuminated fraction of the moons disc.

5.1 I used 48.2 and 48.3


5.2 To use equation 48.5 you will need to obtain or write the atan code yourself to resolve the angle X in the correct quadrant - I wrote a routine: ATAN2(sin_tl,cos_bl).

I have coded all the above to run on my HP Prime graphing calculator and they have proved to be very, very accurate.

For the purpose of accurate determination of the moon phase angle you will need to calculate UTC(date and time) using your zone longitude or better still your local longitude.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.