Page 1 of 2

Moon Phases

Posted: Mon 29 Jun 2015 10:20 am
by Big Daddy
I see on the "issues list" that moon phases was due to be fixed in 3024 but its not crossed off yet so I assume it has not yet been resolved.

My moon phase was showing First Quarter from around 32% to 64% and then changed to Waxing Gibbous. It is not an issue if it is not fixed yet but just wondered if I should be looking for the problem elsewhere.

Andy

Re: Moon Phases

Posted: Mon 29 Jun 2015 11:22 am
by steve
I corrected the reported problem in 3024. I cross problems off when I have confirmation that the problem that was reported has actually been fixed by the change that I did. The reported problem was that MX was giving 'waxing' when it should have been giving 'waning'. I believe that I have fixed that problem.

MX gives 'first quarter' when the moon age is between 5.53699 and 9.22831 days and 'waxing gibbous' from 9.22831 to 12.91963. It should change to 'full moon' from 12.91963 to 20.30228. It uses library routines to determine the age; I can't remember where I got those cutoff values for the phases.

It's currently giving 91% illuminated and 'waxing gibbous', which I believe are (approximately) correct. If there is a problem somewhere it's difficult to investigate unless I am told about it at the time of the problem. Do you believe there is currently a problem?

Edit: It looks to me like the figures I've quoted above for 'first quarter' roughly correspond to 32% to 64% illuminated, so it's not clear to me where you think the problem is. Are you just disagreeing with the cutoff values that I've used? I'm not an astronomer so I have to rely on library routines and information I find on the internet. There are a number of places on the internet where the cutoff values I've used are quoted - https://www.google.co.uk/search?q=9.22831+moon. It looks like it simply divides the lunar month into 8 equal phases. Is that not a reasonable approach?

Re: Moon Phases

Posted: Tue 30 Jun 2015 7:41 am
by Big Daddy
Hi Steve,
Thanks for the reply, I'm not an astronomer either.

When I was using Cumulus 1 I created 200+ images for the moon phases which used the webtags for the moon phase and the visible percentage provided by Cumulus to pull in the correct image using php e.g. Waxing_Gibbous_78, Full_Moon_100 etc.This seemed to work and the boundaries appear to have been set as follows.

New Moon 0% - 1%
Waxing Crescent 1% - 49%
First Quarter 49% - 50%
Waxing Gibbous 51% - 99%
Full Moon 99% to 100%
Waning Gibbous 99% to 51%
Last Quarter 50% to 49%
Waning Crescent 49% to 1%

Don't know if this helps or if the original cut off points are "technically correct".

Maybe there is an astronomer out there that can give some input.

Thanks
Andy

Re: Moon Phases

Posted: Tue 30 Jun 2015 8:00 am
by steve
MX uses the moon age to determine the phase rather than the percent illuminated, it just worked out easier that way. I don't think there are any technically correct boundaries defined; the four main phases are 'instantaneous' anyway, but it doesn't make much sense for them to be treated as such, as they would never actually be seen. The effect of the algorithm in MX is that the arbitrary period assigned to the four main phases is slightly longer than in Cumulus 1. I may look at changing it in MX at some point if the way it does it currently is a serious problem to anyone.

Perhaps Mark would like to comment?

Re: Moon Phases

Posted: Tue 30 Jun 2015 8:51 am
by Big Daddy
Thanks Steve,
Maybe I will take a look at a way of using my images by means of a php calculation based on moon age and percentage, that would be a potential workaround for my particular needs.

Appreciate your time.

Andy

Re: Moon Phases

Posted: Tue 30 Jun 2015 9:46 am
by steve
I've realised what's happened. I originally had the same code in MX as in Cumulus 1. But this was causing the 'waxing instead of waning' problem, so I changed it to use the moon age instead. I think that the problem is that the calculated percent doesn't go negative in MX when the moon is waning, as it's supposed to. I'll see if I can fix that and revert to the original code.

Re: Moon Phases

Posted: Tue 30 Jun 2015 12:08 pm
by steve
OK, sorted. I've put it back to the same as in Cumulus 1.

Re: Moon Phases

Posted: Tue 30 Jun 2015 2:24 pm
by mcrossley
Don't ask me! I do not know of any official definitions. A general practice is to call a full/new etc Moon for the full calendar day on which it occurs.

Now what happens if the event is close to midnight? I'd be tempted to make both days labelled with the event.

Re: Moon Phases

Posted: Tue 30 Jun 2015 2:41 pm
by steve
I think I'm going to stick with the way Cumulus 1 did it, now that I've got it working the same way in MX. At least that's consistent. I think the result is that it says New Moon etc for about 24 hours.

Re: Moon Phases

Posted: Tue 30 Jun 2015 3:30 pm
by Big Daddy
Steve,
Thats brilliant. Thanks, I will wait for the next beta release.

Again, appreciate your work.

Andy

Re: Moon Phases

Posted: Tue 30 Jun 2015 8:54 pm
by BCJKiwi
FYI;
The Saratoga scripts use two methods for this - both sourced from USNO.
One has derived tables of the Unix time for each quarter thru to 2023 by extracting this data from USNO - (used on the "dashboard").

The other gets sun and moon data each daily for your location.
This gives the following data (edited);

Code: Select all

 The following information is provided for Royal Oak, Auckland New Zealand 
 (longitude E174.8, latitude S36.9):
        Wednesday
        1 July 2015           Universal Time + 12h           
SUN
        Begin civil twilight      07:06                 
        Sunrise                   07:35                 
        Sun transit               12:25                 
        Sunset                    17:15                 
        End civil twilight        17:44                 

MOON
        Moonrise                  15:45 on preceding day
        Moonset                   06:08                 
        Moonrise                  16:37                 
        Moon transit              23:50                 
        Moonset                   07:04 on following day

 Phase of the Moon on  1 July:       waxing gibbous 
 with  98% of the Moon's visible disk illuminated.

 Full          Moon on  2 July      2015 at 14:20     
 (Universal Time + 12h).
So these outputs are based on the actual time of the events.

An example use of this data can be seen here http://silveracorn.nz/weather/wxalmanac.php.

Re: Moon Phases

Posted: Tue 30 Jun 2015 9:22 pm
by steve
But is it the script or the USNO data which decides the name of the current phase? And whichever one it is, what algorithm do they use to decide that?

Re: Moon Phases

Posted: Wed 01 Jul 2015 4:58 am
by BCJKiwi
The chunk of data inside the code tags in my previous post is in the form that USNO delivers it.
So that includes the phase:-

Code: Select all

Phase of the Moon on  1 July:       waxing gibbous 
 with  98% of the Moon's visible disk illuminated.

 Full          Moon on  2 July      2015 at 14:20     
 (Universal Time + 12h).
Really just included this to indicate an alternate source - not to suggest that MX should use it.

If you did wish to use USNO data, then the table - actually arrays of times - method might be useful as it is static and would not require getting new info from USNO all the time.
Looking at the script based on the arrays, it works from the time of the next new moon and derives;
phases, and their start and end times,
moon age,
% illumination,
and,
picture number
from there.

Have attached the section of the code from the file so you can see how it is done. as you can see it has been a collaborative effort and been used for some time - present script first released in 2011 and updated since.

Re: Moon Phases

Posted: Wed 01 Jul 2015 7:05 am
by steve
It looks like it assigns a period of 1/28th of the lunar cycle to the major phases, which is approximately the same effect as the calculation in Cumulus 1 and builds of MX apart from 3024 and 3025, just done by a different method - but Cumulus assigns slightly more, somewhere between 24 and 48 hours. I think I'm happy with that; the code in 3024 and 3025 is too crude and assigns too long a period to the major phases (1/8th of the cycle).

Re: Moon Phases

Posted: Wed 01 Jul 2015 7:20 am
by BCJKiwi
Right now MX is saying Full moon and age 99% where USNO still has Waxing Gibbous and an age of 98%.
I don't recall C1 being that different so a change back to C1 code sounds like a good move.