I am using the following R script to plot the moon phase and the moon's illuminated fraction:



t_start <- as.POSIXct("2017-02-23", tz='UTC')
t_end   <- t_start + 75 * 24 * 3600  # 35 days

tm <- seq(from = t_start,
           to  = t_end,
           by  = 10000

moon     <- moonAngle(t=tm, longitude=-8, latitude=47)
fraction <- moon$illuminatedFraction
phase    <- moon$phase - floor(moon$phase)

plot (tm, fraction, type="l", col='blue')
lines(tm, phase   , type="l", col='red' )


# wait for mouse click or enter pressed

This is plotted: enter image description here

The red lines indicate the phase (0 = new moon, 1/4 = first quarter, 1/2 = full moon etc.), the blue curve indicates the how much of the moon is illuminated.

I have expected the illuminated fraction to be zero exactly then when also the phase is zero. However, this is not the case.

So, is there something I am missing, am I doing something wrong in my script or is the implementation of oce inaccurate?

  • $\begingroup$ First of all, you should provide the R package you are using. Second, you might check all the documentation provided in that package to see if there's any discussion of known inaccuracies. Third, can you explain why you're using floor rather than min ? $\endgroup$ Mar 6, 2017 at 13:20
  • $\begingroup$ The library I am using is oce and I cannot explain why I am using floor rather than min. $\endgroup$ Mar 6, 2017 at 14:28

2 Answers 2


This is a partial answer since your question is still unclear. I would recommmend finding an astronomy package for tools like this rather than using what's basically a "bonus feature" from an oceanographic package.

From the help pages for package oce,

fraction of moon’s visible disk that is illuminated
phase of the moon, defined in equation 32.3 of Meeus [1982]. The fractional part of which is 0 for new moon, 1/4 for first quarter, 1/2 for full moon, and 3/4 for last quarter.

Perhaps you are missing the fact that marginally more than 50% of the moon is illuminated, and thus at first/last quarter marginally more than 50% of the visible disk is illuminated? I would also recommend looking up the referenced "equation 32.3" to see what the definition is and how it applies to a zero-altitude viewer.

  • $\begingroup$ I was actually wondering why oce comes with moonAngle. $\endgroup$ Mar 6, 2017 at 18:47

The blue fraction function reaches its maximum at full moon time, 12. März in your diagram.

At that time, the fractional part of the red phase, i.e., moon$phase - floor(moon$phase) reaches 0.5, because a full Moon occurs at half time.

I see no "out of sync" here.

  • 1
    $\begingroup$ Perhaps they just decided to indicate the start of a new moon at the start of the interval when it is oceanographically significant, rather than following the astronomical concept of minimal illumination, which would be in the middle of the oceanographically significant interval of new moon. $\endgroup$
    – antlersoft
    Oct 3, 2017 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .