No it is as simple as Pie . In the case of rotating the two moons you place the formula in the Rotational Field of the layer the image is in .
I could easily Post my Test and you could just copy it all . The Spirit of the community is to offer help but not do the job for the Maker . Your learning curve will be served better by you doing most yourself.
.
.
Thank you.
I didn’t know that the face of the moon that we see rotates, I thought we saw the Man in the Moon and then there was the dark side. So, your formula will solve a problem I hadn’t realised I would encounter.
I am guessing that I need to pre-rotate the moon image I use before inserting it (based on the view displayed on a website such as moonphases.co.uk) so it will then track correctly?
But my original question was regarding the discrepancy between the actual phase on my watch and the phase shown on the website. Yesterday, according to the website, we were still in waxing crescent but my watch was displaying first quarter. I have run the time machine forward and it appears to be a day ahead throughout the cycle? Is this something that can be corrected?
Because of the way the 8 image phase display works on Facer each is displayed for about 3.666 days per image . So it is going to show the image for the next phase at least a day early . On WFS they have the Full , New and Quarters for 1 day . That in a way is worse as the Waxing and Gibbous moons are shown for 6 days .
If you use the Rotating moon images you will see no jumps . Please inspect the work above to get an Understanding . Any of them can be put on your watch as well .
You must Realise by now the Facer Default Moon Layer is Completely different from The Examples above . Perhaps we need to start a Beginners Moon Phase Topic . Rather than Hijack this Topic which is Obviously Advanced .
Would you consider recalculating both your simple and complex moon phase formulas using a more robust source?
https://giangrandi.org/soft/mooncalc/mooncalc.shtml
If you view the page source (and scroll down in the code to the <script>
section to find the array titled moon_phases_list
) you’ll see 100 years of moon data (!) that is calculated using highly accurate methods. Might be fun to use this data as your basis, see how close your formulas are…and then outdo yourself once again!
Worth a shot? If you do this, you’ll probably have the most accurate closed-form moon phase formula on the entire web.
Thanks for the link and the suggestion. I will take a look. Cheers.
Mmm, not sure that there will be much to be gained. The list they have is for four phases and comes from NASA. The data I used has four phases and comes from the US Navy Observatory which is the official source ( NASA is not the official source ). The times might be different but there is no way of knowing which prediction is more likely to be correct. Indeed, the way one would normally check such data is to compare it to the US Navy data ( as the official true data ). What would be good would be to have data for more than the four phases to fill in the gaps in the US Navy data - assuming that the 4 phases in the more detailed set still align with the US Navy data.
Thanks again.
Cheers
Mike
Your equations did not take into account the longer 100-year timeline — the additional data should allow you to adjust your parameters so that the error is minimized over a longer period of time. AFAIK the methods used in the calculations of this lunar data are as good as what the US Navy Observatory uses (at least for this purpose).
I attempted to analyze your equation parameters against the data and, as you can see in the attached screenshot, your settings provide very low error rates in the 20-year span you corrected for — but then it starts to deviate quite a bit before and after that point.
I normalized the field as integers (in a section of the table not shown in this screenshot) so that I could play with the values easily, but I do not know how to modify the parameters to reduce the error over the entire 100-year period.
Hoping you’re still up for the challenge! I could send you this excel document if that would be helpful.
Wow ladies and gentlemens, i proudly presents… experts at work
Ladies and gentlemen… I did it!
I used Fourier analysis and Discrete Fourier Transforms to reverse-engineer the next 75 years of moon phase data. This allowed me to derive a new phase equation that is very compact, extremely accurate, and will remain so for… probably the next 1000 years.
This was a long and arduous process. I had to learn some python code and I used Chat GPT to help me learn these unfamiliar concepts, which was essential in helping me fit a new series of sin curves to the moon data.
Here is a comparison between the relative error of @mikeoday’s previous equation (which really is very accurate) and mine (shown in red) from today’s date until the year 2100. You can see that Mike’s equation is pretty stable for the next 20 years or so, but then it starts to become more inaccurate over time.
Here are the equations formatted for both Facer and for Python in case some of you want to run it through your own paces:
(((#DNOW#/2551442844-0.228535)
+0.01765sin(#DNOW#/378902233-1.828)
+0.00583sin(#DNOW#/5022682843-3.179)
-0.00383sin(#DNOW#/437445587-4.186)
-0.00057sin(#DNOW#/218722742-2.084))%1)
Here’s a 1-line version that is easy to copy into Facer Creator:
(((#DNOW#/2551442844-0.228535)+0.01765sin(#DNOW#/378902233-1.828)+0.00583sin(#DNOW#/5022682843-3.179)-0.00383sin(#DNOW#/437445587-4.186)-0.00057sin(#DNOW#/218722742-2.084))%1)
Here’s a version that works in Python, which uses Unix time output in seconds (instead of milliseconds like Facer’s “#DNOW#” function does) so we have to adjust our scalars in the formula slightly:
import time
import math
def moonPhaseCalc():
cTime = time.time()
mCalc = ( ( cTime / 2551442.844 - 0.228535 )
+ 0.01765 * math.sin( cTime / 378902.233 - 1.828 )
+ 0.00583 * math.sin( cTime / 5022682.843 - 3.179 )
- 0.00383 * math.sin( cTime / 437445.587 - 4.186 )
- 0.00057 * math.sin( cTime / 218722.742 - 2.084 ) )
return mCalc % 1
print(moonPhaseCalc())
Now… could I make it even more accurate? …Perhaps, but we’re at a point of diminishing returns here. My new equation should be no more than 20 minutes off from the true phase of the moon, and for all practical purposes… this is probably overkill.
That being said, I couldn’t resist the challenge. And frankly, I hope someone else attempts to improve on it! Many thanks to @mikeoday for the original formulation, which was highly instructive and gave me a great starting point — all I’ve done is derive new values for the other terms. I may post again with further refinements, but this is pretty good now!
Cheers!
WOW. I used @mikeoday Formula for my moon age stuff. Always with Thanks. Since Facer Launched #MOONAGEPERCENT# I have been using that. The way I have been using it ( crudly ) it is within half a day of my other moon Data I use. I am wondering how it stacks up to the work you have done. I can not pretend to do the work you have done. I am from the school of Copy and Paste. Thank you very much Indeed for your work. I often say that Science can not be done on our Watches. I was wrong to say that.
.
@p.hennessey Sadly your reworked formula will not work for me in creator and I am not clever enough o fix it . I think it needs to be on one line and format protected . I guess some formatting has crept in and it shows nothing . I look forward to testing it .
OK I fixed it . The * went missing . As they often do . Thankfully the strategy is the same as Mikes so I was able to spot the difference .
.
(((#DNOW#/2551442844-0.228535)+0.01765*sin(#DNOW#/378902233-1.828)+0.00583*sin(#DNOW#/5022682843-3.179)-0.00383*sin(#DNOW#/437445587-4.186)-0.00057*sin(#DNOW#/218722742-2.084))%1)
.
Tests Follow .
I would like to thank you Guys and Everyone that contributes to this Amazing Community .
Someone on the WFS Forum is asking where he might find resources like Hands and Dials . Not only those but also these contributions of Formulas that can Elevate work done on Face to the Upper Level are amazing . Totally Unique and Totally amazing . I am actually very Proud to call myself part of this community .
Under test I find the difference between the two Complex formulas in the year 2100 two minutes or there about . If my memory serves me the Unix Epoch Timer ( #DNOW# ) will be redundant by that time . Roll on the 64 Bit one which as far as I know has not been named yet . I kind of guess they will just patch the 64 bit count in one day in 2038 I believe
.
.
Please bear in mind that the data I used to derive this updated formula came from the work of Fred Espenak (NASA/GSFC).
It should be noted that Fred is responsible for calculating NASA’s solar eclipse maps:
https://www.researchgate.net/figure/Eclipse-Predictions-by-Fred-Espenak-NASAs-GSFC-http-eclipsegsfcnasagov-Figure_fig2_380630045
Yes . I know that NASA is considered one of the standards and the US Navy Data . Did you get time to check the Facer Tag .
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).
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 .
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!
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.
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 )
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:
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 .