Moon Phase formula - updated

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

I look at several references and the all show slightly different things . I know you have shown us how to compensate for the Time Zone but for me something better than the 8 image Job is Good for me . My other Gadget on my Watch is the Moon on a Stick . That always seems to be spot on . I originally ran that with Your Long formulas but have converted it to #MOONAGEPERCENT# Now .
.

3 Likes

This Has Both the Moon on a stick Formulas For comparison .
.

3 Likes