tag of the age of the moon (in days)

84 views
Skip to first unread message

P C

unread,
Mar 30, 2021, 4:41:15 AM3/30/21
to weewx-user

Hello, again me ;)

I am looking for the tag of the age of the moon (in days) that goes from New Moon in New Moon in 29 days. This means that the full moon is between the 14th and the 15th day.

NB: Pyephem is installed

Thank you !

Tom Keffer

unread,
Mar 30, 2021, 5:06:24 AM3/30/21
to weewx-user
Could you use

    #set $days=$almanac.moon.moon_fullness * .2953
    <p>The moon is $days days old.</p>


.2953 is the length of the lunar cycle, divided by 100.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/1cfbff31-a41c-4da6-a12c-49b251e5f7e2n%40googlegroups.com.

Blaise

unread,
Mar 30, 2021, 5:58:24 AM3/30/21
to weewx...@googlegroups.com

Well no, Tom,

This tag gives "the lighting" of the moon: 100% = full moon, 0% = new moon.
So it goes from 0% to 0% (new moon) via 100% (full moon). It does not indicate the age of the moon, since we do not know where we come from and to what we are going.
I had the same idea: "#set $md = int (($almanac.moon_fullness / 3.45) +.5)"

PS: What is the difference between "$almanac.moon_fullness" and "$almanac.moon.moon_fullness"?

An other idea ?

thank you,

Pascal


Le 30-03-21 à 11:05, Tom Keffer a écrit :
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/VCqOBb3Hhag/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEADYLZQLTfzR30skH0yBvFDPEe3Zuw0w3vuwEGjmE5yMw%40mail.gmail.com.

Blaise

unread,
Mar 30, 2021, 6:13:50 AM3/30/21
to weewx...@googlegroups.com

This because I have 29 images of the moon in its different phases :

#set $md = int (($almanac.moon_fullness / 3.45) +.5)

#set $fmd = "/images/lune- "+ str ($md) +" .png "
<div class = "dans_entete">
    Lune & NBSP;: & nbsp; $almanac.moon_phase <br> $almanac.moon_fullness & nbsp;% <br>
    <br> <img alt = "$md + '" src = "$ fmd" width = "50%">
</ div>

Le 30-03-21 à 11:05, Tom Keffer a écrit :
Could you use
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/VCqOBb3Hhag/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEADYLZQLTfzR30skH0yBvFDPEe3Zuw0w3vuwEGjmE5yMw%40mail.gmail.com.

gjr80

unread,
Mar 30, 2021, 6:52:48 AM3/30/21
to weewx-user
I have a similar requirement in WeeWX-WD. I use something along the lines of:

#set $moonAge = $time.gmtime($current.dateTime.raw - $almanac.previous_new_moon.raw)
#set $moonDays = int(round(($current.dateTime.raw - $almanac.previous_new_moon.raw)/86400,0))

$moonAge is the time since the previous new Moon in seconds, $moonDays is the whole number of days since new Moon. Dividing by 86400 may not be daylight saving safe but it is old code and good enough for my use, YMMV :)

Gary

P C

unread,
Mar 30, 2021, 10:14:34 AM3/30/21
to weewx-user
Merci,

#set $moonDays = int(round(($current.dateTime.raw - $almanac.previous_new_moon.raw)/86400,0))

est parfait !
Reply all
Reply to author
Forward
0 new messages