Moon Phase formula - updated

I’m not sure what a Facer tag is… I must confess that I am not a user of Facer. I am an astronomy enthusiast and recreational programmer, and I found this message thread after trying to research my own moon phase formula.

Edit: This site has rules for new users that prevents me from replying further (I am only able to update previous posts.) I think that I might start a new thread that is dedicated to the moon phase calculation and cataloging the progress made in this thread.

Quick note: I compared the NASA data with the NAVY data, and they are identical most of the time, and only differ by a maximum of 2 minutes at any given moment. My formula works well with either data set (as does Mike’s).

3 Likes

Ok . Well I think your contribution is appreciated . The facer TAG is an element in Facer Creator that gives the age of the Moon 0 to 1 beginning at the New Moon . #MOONAGEPERCENT# . I think you should have a look at the creator Tags they have distance from the earth to the Moons Apogee and some other stuff that I would never use .

2 Likes

Congratulations, excellent job!

As for further improvements … you could take a look at the next largest coefficients in your Fourier series to see if they are significant compared to the lowest you currently have ( -0.00057 ). That would give you an indication if it is worth the effort adding more terms.

Thanks for sharing your work and the new “go to standard” for accurate phase predictions!

4 Likes

The main issue with the Tag is ( was ? ) that it seems to use local time rather than GMT. That means that the small error that you demonstrate is dwarfed by the timezone difference. So if one lives in the UK, the error won’t be too bad but the further you get from GMT, the larger the error. From memory the maximum timezone difference is of the order of 14hrs. Here it 9 hrs or so. Having said all that, it may have been fixed - I have not checked since shortly after the tags came out. If I get the chance I will take a look - easy enough to do, one just needs to change the timezone on the phone/watch, if it has been fixed the phase will not change.

4 Likes

Confirmed - Moon Age tag uses local time not UTC

Phone/Watch set to UTC: age of moon 26.753

Phone/Watch set to local time ( +9.5hrs ): age of moon 27.149

Additional error for my location: 9.5 hours ( ie. timezone offset )

3 Likes

I believe the following will correct the #MOONAGE# tag:

((#MOONAGE#+(#DOFST#/1440)+29.530588)%29.530588)

One is still left with any residual small offset that may be there due to the model accessed by the tag but the timezone offset error should be corrected.

edit:

See the following for more details:

4 Likes

Amazing . Thanks Mike . Sadly I have been posting Topics Bigging up the Facer Tag . I have been working in Blissful Ignorance as I am on BST / GMT . I have a gadget on My watch and a few I have published that has the Moon on a stick relative to a 24 Hrs Sun on a stick . Where I am for me it successfully predicts the New Moon the Quarters and Full . Not to mention the Tides . For me it is the Visual aspect of what we see of the Moon in the Sky and it’s approximate position that I am looking for on my Watch so that is good for me . Thanks for this Fantastic work . Everyday must be a Learning Day .

4 Likes

wow again one of your legendary test faces

2 Likes

@mikeoday or @p.hennessey Please Help if you have some spare Time. In my Ignorance I have been fooling myself that this formula gives me the Moon Illumination Percent Value . While it is right for the Full , New and Quarters it is obviously wrong compared to proper values in-between . Is it possible to get it a bit better with Sin or Cos . Thanking you in anticipation .

(round(100-((abs((#MOONAGEPERCENT#)-0.5))*200)))

4 Likes

OK @mikeoday @p.hennessey and @kirium0212 I think I have it . I am Very pleased with myself . This stuff is difficult by trial and error . However thank you all so very much for the Inspiration.
.
.

(50+((sin(rad((((#MOONAGEPERCENT#)*360))-90)))*50))

4 Likes

OK - I will ask the obvious question. I have 28 images and I’m going to put this formula into the opacity tag but how does this formula know which image to show?

2 Likes

#MOONAGEPERCENT# Gives 0 to 1 multiply that by 28 . I Foor that and ensure that you conditional in the opacity Box is zero for the New Moon etc .
I have posted a Topic on the Subject .

1 Like

Ha Ha . I see what you mean the Formula above is for a Text Box . Showing the level of Illumination during the Lunar month .

1 Like

‘Hoisted by my own petard’, as they say… I should of searched further first! :slight_smile:

2 Likes

Well . As always I have not completely understood your question . If you are talking about using the Scientific formulas of the Masters above it is a little different . These Master Mathamatician usually compose formulas that Give a result O to 1 . That is so that you can simply use it for rotation Text or Opacity . You have to just take it apart very carefully untill you get the core result . If you say which one your would like to use I will have a go at Butchering it if the relevant master dose not get there first .

1 Like

Thanks for your help - i have a plan …I’m going to use your moonpercent formula result in a conditional for each of my 28 moons and check against moon phases for November and see what I get.
I’ll get back here if I’m successful and even quicker if I’m not!

4 Likes

Yes . November this year ( 2024 ) is a good one as far as I remember . New on the 1st .

1 Like

The complex formulae above return a number between 0 and 1, where:
0 = new moon
0.5 = full moon
1= new moon

So, the image for 0 and 1 is the same, ie. new moon

If your collection of 28 images has only 1 new moon image ( ie.images for ( new moon ) to (1 less than new moon ) ), then you would need 29 layers with the new moon image repeated for layers 1 and 29.

If on the other hand you set of images has the new moon at either end then you would only need 28 layers.

And to be more precise, the new moon image actually should start 0.5 units before new moon and end 0.5 units after. The same for all of the images, 0.5 units before and after.

Assuming there are A layers, the opacity for layer 1 would be:

${complex moon age formula} >= ( (A-0.5) x (1/A) ) || {complex moon age formula} < ( 0.5 x (1/A) )?100:0$

Numbering the layers n=1…A, the opacity of layers 2…A would be:

${complex moon age formula} >= ( ( A - 1.5 ) x ( 1 / A) ) && {complex moon age formula} < ( ( A - 0.5 ) x ( 1 / A) )?100:0$

5 Likes

I went for 0 to 28 with one New Moon image as the quarters seemed to fall nicely . I could see this simplification had half day errors . But standing up to the Weather Seps and Heart Rate it seems good enough and a step up from the 8 image version that stay current for over 3 days . Thanks for the Science @mikeoday .

3 Likes

Cool.

Certainly no-one will see the 1/2 day difference. Particularly given that any static image set is captured/generated based on only one lunar cycle, whereas the actual visual moon phase on any intermediate day of a randomly chosen lunar cycle is unlikely to exactly match the true view as seen by looking up :blush:

{ That is, the formulae are only certain to be accurate 4 times a cycle.

Plus the visual difference between one image and the next is only relevant for the particular lunar cycle it was generated for …

I do see it in my image set - I have 60 odd images and for most months there are way too many images near new moon and not enough near full moon; I believe that means that the set was likely generated for a lunar cycle where the new moon occurred when the Moon was near its furthest distance from the Earth in its elliptical orbit and hence moving slowest. For example, on my watches, a day or two after new moon, the displayed image barley shows the tiniest sliver of a moon, whereas looking up one can clearly see the edge of the Moon}

3 Likes