MoonPhase 2.0 Lunar knowledge of any date and time, plus orbital calculator

Description

First update in under 12 hours. This provides information on the current lunar phase based on the time and date it is requested, OR based on any date in history or in the future. The computation is done on the device, no API’s are called.

Blocks

Index returns a number of or between 0 and 7.

  • 0 new moon,
  • 1 waxing crescent,
  • 2 first quarter,
  • 3 waxing gibbous,
  • 4 full moon,
  • 5 waning gibbous,
  • 6 last quarter,
  • 7 waning crescent.

Current moon phase gives a percentage of illumination of the lunar surface.

The age of the moon returns how old the moon is in its current lunar cycle.

These next blocks are a little Kepler calculation to tell you what the speed and orbital distance of a planet would be, if you changed the mass of the sun, and changed how long a “year” would be. It returns the Distance, and Velocity of the planet.

image

Instructions.

Index returns an integer, Phase returns a number with decimal points (technically it could be a negative -99.99 – 0 – 99.99.

Age returns a String with a description.

Here are all three blocks in action with some labels

For the blocks on any custom date, everything is number based. No dashes etc.

For the Orbital Calculator, please ensure the mass of the sun does not exceed 200x. That would collapse the solar system and I like our solar system as it is thank you!

Download .

MoonPhase.aix (21.8 KB)

10 Likes

Great extension!
I’m curious as to how it calculates the phase based on the date.
Could you throw some insight on how your algorithm works?

1 Like

It is very very complex maths. You need to determine the position of the sun, and the moon, and there are a number of standards. Here is an example of some of the math numbers involved.

   double date_within_epoch;
    double sun_eccent;
    double sun_mean_anomaly;
    double sun_perigree_co_ordinates_to_epoch;
    double sun_geocentric_elong;
    double moon_evection;
    double moon_variation;
    double moon_mean_anomaly;
    double moon_mean_longitude;
    double moon_annual_equation;
    double moon_correction_term1;
    double moon_correction_term2;
    double moon_correction_equation_of_center;
    double moon_corrected_anomaly;
    double moon_corrected_longitude;
    double moon_present_age;
    double moon_present_phase;
    double moon_present_longitude;
6 Likes

how to see moon phase of some other day?

It will be available in a future version.

1 Like

Now available and working.

1 Like

I am trying to get moon phase index for a whole month. so far i tried this and it works (after doing some improvements) but I have to do it for all dates individually. is there any other way to do this?

Try this type of approach, using for loops and lists.

2 Likes

We get these values from 0 to 7 for 3 to 4 dates like this, if I call the data for a whole month.

How we know that which one is truly number 0 (new moon) or number 4 (full moon)

Use the Moon Phase, not the Moon Phase Index.

It gives you the exact percentage of the moons darkess or brightness

So in Moon phase -99 means new moon and 0 means full moon?
How to know when it’s new moon or full moon?

The New Moon phase is around the 0.0 value and the Full Moon phase is around the +/-99.9~ value.

oh, but I am really confused that how can we use it to show in a label that if it is a new or full moon

So you want when it is the newest exact time?

I am creating a calender in which I want this moon feature too. So I am using images of full moon, new moon, first quarter, etc but I don’t know when will be new moon and when will be full moon using moon phase.
Is there any component which I can use here like. If value is greater then +99 it will be full moon and if value is 0 or in between 0.01-0.09 it will be new moon.

The highest number is 99. Anything close to 99 would be a “full moon”, the Lunar index is the proper breakdown of the moon status.

0 is New moon always. -99 or +99 is full moon always.

In the index, 0 is New Moon and 4 is full moon.

If you pick the middle of the three days of the index for the Full Moon, it will be at its brightest. Same with the New Moon, pick the middle of the three days from the index, and it is the darkest.

Alternatively you can get the lunar phase on each day, and the number closest to 99 is Full, and number closest to 0 is New.

I think the download link isn’t working properly.