******************************************************************************
SIMPLE LUNAR PHASE ANGLE TABLE FUNCTION DEMO
Built around the NASA/JPL Horizons API
PHP Program by Jay Tanner - 2025
This program is based on a custom function to generate a simple lunar phase
table over a given range from a single date to multiple dates spanning any
general interval at any given time step size.
This demo program generates a table of the simple geocentric lunar phase
angles for each date of the current month at 00:00:00 UTC on each date.
It is called the 'simple' lunar phase because it is geocentric and based on
the simple difference between the ecliptical longitudes of the moon and sun
at the same moment and excludes the tiny effects of librations, but still
results in a good enough lunar phase approximation for most practical pur-
poses and general small-scale graphical simulations.
-----------------
CALLING TEMPLATE:
PhaseTable = Lunar_Phase_Table (StartDateTimeStr, StopDateTimeStr, StepSize,
TimeZone, DaySumYN, HeaderYN)
*********************************************************
Geocentric Lunar Phase Table
Time Zone = UT+00:00 (dJDate = +0.0000000000)
Day/Summ Time = No
Table Header = Yes
START Date/Time = 2025-Nov-01 00:00:00 (Standard Time)
STOP Date/Time = 2025-Nov-30 00:00:00
Step Size = 1 day
=========================================================
Loc_Date Loc_Time Cnst Julian_Date_UT Phase_Ang
============ ======== ==== ================= =========
2025-Nov-01 00:00:00 Aqr 2460980.500000000 118.04952
2025-Nov-02 00:00:00 Aqr 2460981.500000000 130.88899
2025-Nov-03 00:00:00 Psc 2460982.500000000 144.20842
2025-Nov-04 00:00:00 Psc 2460983.500000000 157.96936
2025-Nov-05 00:00:00 Ari 2460984.500000000 172.07516
2025-Nov-06 00:00:00 Ari 2460985.500000000 186.37475
2025-Nov-07 00:00:00 Tau 2460986.500000000 200.68253
2025-Nov-08 00:00:00 Tau 2460987.500000000 214.81072
2025-Nov-09 00:00:00 Aur 2460988.500000000 228.60299
2025-Nov-10 00:00:00 Gem 2460989.500000000 241.95715
2025-Nov-11 00:00:00 Cnc 2460990.500000000 254.83110
2025-Nov-12 00:00:00 Cnc 2460991.500000000 267.23488
2025-Nov-13 00:00:00 Leo 2460992.500000000 279.21542
2025-Nov-14 00:00:00 Leo 2460993.500000000 290.84050
2025-Nov-15 00:00:00 Vir 2460994.500000000 302.18532
2025-Nov-16 00:00:00 Vir 2460995.500000000 313.32295
2025-Nov-17 00:00:00 Vir 2460996.500000000 324.31830
2025-Nov-18 00:00:00 Vir 2460997.500000000 335.22516
2025-Nov-19 00:00:00 Lib 2460998.500000000 346.08565
2025-Nov-20 00:00:00 Lib 2460999.500000000 356.93161
2025-Nov-21 00:00:00 Sco 2461000.500000000 7.78766
2025-Nov-22 00:00:00 Oph 2461001.500000000 18.67525
2025-Nov-23 00:00:00 Sgr 2461002.500000000 29.61728
2025-Nov-24 00:00:00 Sgr 2461003.500000000 40.64238
2025-Nov-25 00:00:00 Sgr 2461004.500000000 51.78839
2025-Nov-26 00:00:00 Cap 2461005.500000000 63.10415
2025-Nov-27 00:00:00 Cap 2461006.500000000 74.64916
2025-Nov-28 00:00:00 Aqr 2461007.500000000 86.49057
2025-Nov-29 00:00:00 Aqr 2461008.500000000 98.69680
2025-Nov-30 00:00:00 Psc 2461009.500000000 111.32725
*********************************************************
Table to help visualize the lunar phase angles:
PhaseAng Description
-------- -----------------
0° New Moon
45 Waxing Crescent
90 First Quarter
135 Waxing Gibbous
180 Full Moon
225 Waning Gibbous
270 Last Quarter
315 Waning Crescent
360/0 New Moon
******************************************************************************
To compute the simple geocentric lunar phase angle (0 to 360 deg) based on
the ecliptical longitudes of the moon and sun at the same moment also in the
the range from 0 to 360 degrees:
Let:
PhaseAng = Simple lunar phase angle (0 to 360 deg) based on the
difference between the ecliptical longitudes.
Given:
Lm = Geocentric ecliptical longitude of the moon (0 to 360 deg).
Ls = Geocentric ecliptical longitude of the sun (0 to 360 deg).
Then, the simple phase angle may be found
by one of the following simple algorithms:
----------------------------------------
w = 360 - Lm + Ls
if (w > 360) then w = w - 360
PhaseAng = 360 - w
----------------------------------------
Or, the alternate equivalent:
w = 360 - Lm + Ls
PhaseAng = 360 − (w −= (w > 360)? 360:0)
******************************************************************************
|