<p>I have googled for such a solution but I have not found anything substantial: I found one website but it was someone's side hobby so my confidence in it is low.</p>
<p>Thankfully, I have discovered Stellarium but I want another tool to compare against.</p>
<p><strong>QUESTION</strong><br />
Tool for moonrise, moonset and moon phase for <strong>any</strong> date - even thousands of years ago - and for <strong>any</strong> location.</p>

CC BY-SA 4.0
2022-09-28T20:31:03.150Z
JPL Horizons does what you ask: https://ssd.jpl.nasa.gov/horizons/app.html#/
Greg Miller
CC BY-SA 4.0
2022-09-28T20:51:19.120Z
@GregMiller as a nerd, that site is awesome!
Bob
CC BY-SA 4.0
2022-09-29T02:03:10.790Z
Also see the [Horizons API](https://ssd-api.jpl.nasa.gov/doc/horizons_file.html). The Horizons Observer table has two quantities for phase (24, 43), but note that they are for the 3D phase angle. The [principle lunar phases](https://en.wikipedia.org/wiki/Lunar_phase) use the angle between the Sun & Moon in the ecliptic plane. I have some info (& Horizons code) related to that [here](https://astronomy.stackexchange.com/a/49781/16685). That code is geocentric, so it doesn't correct for the lunar parallax or atmospheric refraction, but Horizons can easily do that stuff if you want.
PM 2Ring
CC BY-SA 4.0
2022-09-29T13:52:10.690Z
@Bob if you know a little Python or would like to learn, the [Skyfield](https://rhodesmill.org/skyfield/) package does all that you need. It loads basically the same [JPL Development Ephemerides]() that Horizons uses, but you can run it locally instead of having to query a website.
uhoh
CC BY-SA 4.0
2022-09-29T21:37:29.657Z
(fixed the link: [JPL Development Ephemerides](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris))
uhoh
CC BY-SA 4.0
2022-10-05T17:39:12.860Z
@uhoh I know how to use the JPL site to get percent illumination but I notice the illumination never goes to zero for a new Moon. Is there a parameter that tells me the "phase percentage"?
Bob
CC BY-SA 4.0
2022-10-05T23:42:00.847Z
@Bob The Sun-Moon-Earth angle can be calculated as the arccosine of the dot product of the unit vectors drawn from the Moon to the Sun and Earth (I'm assuming you get these vectors by subtracting the ephemeris xyz positions of the Sun's center and some position on the Earth's surface as observed from the Moon's center). Once you have that angle, there will be a formula out there somewhere that returns a phase percentage", depending on how you like do define it. Perhaps you mean illuminated fraction? (phase usually refers to an angle)
uhoh
CC BY-SA 4.0
2022-10-05T23:43:47.010Z
@Bob The reason it doesn't go to zero or one is because the Moon's orbit is inclined with respect to the Earth's orbit. You'll get very close to zero during a solar eclipse and very close to one during a lunar eclipse. It is possible that if you start searching the Horizons website you may find their mathematical definition. You may have to click on over to the SPICE area to find it though. You could also ask a new "reference request" question here, asking specifically about how Horizons defines the value you're seeing. I think that will likely work.
uhoh
CC BY-SA 4.0
2022-10-05T23:48:30.110Z
@Bob oh, you did! [JPL Ephemeris or Skyfield - how to get moon phase percentage (not illumination percentage)](https://astronomy.stackexchange.com/q/50659/7982)
uhoh
<the-moon><software><moon-phases>
tool to calculate moonrise/moonset and moon phase for any date for any location
Bob
# tool to calculate moonrise/moonset and moon phase for any date for any location

(Asked by: username_0 on 2022-09-28)

I have googled for such a solution but I have not found anything substantial: I found one website but it was someone's side hobby so my confidence in it is low.

Thankfully, I have discovered Stellarium but I want another tool to compare against.

**QUESTION**  
Tool for moonrise, moonset and moon phase for **any** date - even thousands of years ago - and for **any** location.

**Tags:** the-moon, software, moon-phases

> **Comments:**
> **username_1**: JPL Horizons does what you ask: https://ssd.jpl.nasa.gov/horizons/app.html#/  
> **username_0**: @username_1 as a nerd, that site is awesome!  
> **username_2**: Also see the [Horizons API](https://ssd-api.jpl.nasa.gov/doc/horizons_file.html). The Horizons Observer table has two quantities for phase (24, 43), but note that they are for the 3D phase angle. The [principle lunar phases](https://en.wikipedia.org/wiki/Lunar_phase) use the angle between the Sun & Moon in the ecliptic plane. I have some info (& Horizons code) related to that [here](https://astronomy.stackexchange.com/a/49781/16685). That code is geocentric, so it doesn't correct for the lunar parallax or atmospheric refraction, but Horizons can easily do that stuff if you want.  
> **username_3**: @username_0 if you know a little Python or would like to learn, the [Skyfield](https://rhodesmill.org/skyfield/) package does all that you need. It loads basically the same [JPL Development Ephemerides]() that Horizons uses, but you can run it locally instead of having to query a website.  
> **username_3**: (fixed the link: [JPL Development Ephemerides](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris))  
> **username_0**: @username_3 I know how to use the JPL site to get percent illumination but I notice the illumination never goes to zero for a new Moon. Is there a parameter that tells me the "phase percentage"?  
> **username_3**: @username_0 The Sun-Moon-Earth angle can be calculated as the arccosine of the dot product of the unit vectors drawn from the Moon to the Sun and Earth (I'm assuming you get these vectors by subtracting the ephemeris xyz positions of the Sun's center and some position on the Earth's surface as observed from the Moon's center). Once you have that angle, there will be a formula out there somewhere that returns a phase percentage", depending on how you like do define it. Perhaps you mean illuminated fraction? (phase usually refers to an angle)  
> **username_3**: @username_0 The reason it doesn't go to zero or one is because the Moon's orbit is inclined with respect to the Earth's orbit. You'll get very close to zero during a solar eclipse and very close to one during a lunar eclipse. It is possible that if you start searching the Horizons website you may find their mathematical definition. You may have to click on over to the SPICE area to find it though. You could also ask a new "reference request" question here, asking specifically about how Horizons defines the value you're seeing. I think that will likely work.  
> **username_3**: @username_0 oh, you did! [JPL Ephemeris or Skyfield - how to get moon phase percentage (not illumination percentage)](https://astronomy.stackexchange.com/q/50659/7982)  

---

## 0 answers

