Closed JeffRossMT closed 2 years ago
Those are two different numbers that mean different things. Where in the Skyfield documentation could the description of the Moon phase be improved to clarify that it's the Moon's angle around the sky, not its percent illumination?
To learn the fraction of its surface that's illuminated, try the fraction_illuminated()
Skyfield method:
https://rhodesmill.org/skyfield/api-position.html#skyfield.positionlib.ICRF.fraction_illuminated
See if that gives you a result that matches more closely!
Thank you Brandon! I did a poor job of reading and understanding the documentation. Phase of the Moon in my mind equates to New, Waxing Crescent and so on and that's how pyephem uses it.
Perhaps add a line like this:
jross@MacMini:/Users/jross $ diff -U3 examples.html.orig examples.html
--- examples.html.orig 2022-03-02 22:28:06.000000000 -0700
+++ examples.html 2022-03-18 12:27:59.000000000 -0600
@@ -138,6 +138,7 @@
90° at the First Quarter,
180° at the Full Moon,
and 270° at the Last Quarter.</p>
+<p>To find what portion of the Moon is illuminated, see the <a href = "https://rhodesmill.org/skyfield/api-position.html#skyfield.positionlib.ICRF.fraction_illuminated">fraction illuminated</a> routine.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">skyfield.api</span> <span class="kn">import</span> <span class="n">load</span>
<span class="kn">from</span> <span class="nn">skyfield.framelib</span> <span class="kn">import</span> <span class="n">ecliptic_frame</span>
@@ -456,4 +457,4 @@
</div>
</body>
-</html>
\ No newline at end of file
+</html>
What module do I import to use fraction_illuminated()?
Jeff
What module do I import to use fraction_illuminated()?
Happily, it's a method on the position you already have; no need to import anything (assuming you have the most recent 1.42 version of Skyfield).
Exactly how would one go about using this, in context of the above script? What 'object' or variable is it called from? (fraction_illuminated)
Exactly how would one go about using this, in context of the above script?
The script would need to keep the Apparent position object, instead of throwing it away after the frame_latlon()
call. It would look something like:
m = e.observe(moon).apparent()
fraction = m.fraction_illuminated(sun)
Got it. I ended up going with just using the new moon/conjunction date/times spat out from the almanac library.
@JeffRossMT @hanetzer — I've added the fraction of the moon that's illuminated to that example in the documentation, as you can see from the commit just above this comment. The new docs should appear with the next Skyfield release. Thanks for the idea!
Hello!
I have something odd that could very well be my failure to understand how to get the current phase of the moon via skyfield.
I'm using https://svs.gsfc.nasa.gov/4955 as my authoritative source, using Month: 3, Day: 13, UT Hour: 21 as the input for the Moon Phase and Libration, 2022 page.
Here's the short python3 script I'm using:
Running that I get:
pypehem's percent illuminated matches NASA's but I can't see any way to make skyfield's Moon phase result come anywhere near the Waxing Gibbous phase that the Moon is currently at.
What am I missing?
Thanks,
Jeff Ross