I have 28 moon images
http://www.standrewsbeach.net.au/weather/current/
and use this extension
#
# Find the Image name for the Current Moon
#
from datetime import datetime
import ephem
from weewx.cheetahgenerator import SearchList
class MoonImage(SearchList):
def __init__(self, generator):
SearchList.__init__(self, generator)
def get_extension_list(self, timespan, db_lookup):
date = ephem.Date( datetime.now() )
nnm = ephem.next_new_moon( date )
pnm = ephem.previous_new_moon( date )
lunation = ( date - pnm ) / ( nnm - pnm )
imageno = lunation * 26
imagename = "moon_" + str( int( imageno + 0.5) - 1 ) + ".gif"
search_list_extension = {'cmoon_image' : imagename }
return [search_list_extension]
And also this to find the next moon phases
#
# find the next 4 phases of the moon ordered by date
#
from datetime import datetime
import ephem
from weewx.cheetahgenerator import SearchList
class NextMoons(SearchList):
def __init__(self, generator):
SearchList.__init__(self, generator)
def get_extension_list(self, timespan, db_lookup):
moons = []
date = datetime.now()
nextdate = ephem.next_new_moon( date )
moons.append( ( nextdate.datetime() ,
nextdate.datetime().strftime("%a %-d %b") , 'New Moon' , 'moon_0.gif' ) )
nextdate = ephem.next_first_quarter_moon( date )
moons.append( ( nextdate.datetime() ,
nextdate.datetime().strftime("%a %-d %b") , 'First Qtr' , 'moon_7.gif' ) )
nextdate = ephem.next_full_moon( date )
moons.append( ( nextdate.datetime() ,
nextdate.datetime().strftime("%a %-d %b") , 'Full Moon' , 'moon_14.gif' ) )
nextdate = ephem.next_last_quarter_moon( date )
moons.append( ( nextdate.datetime() ,
nextdate.datetime().strftime("%a %-d %b") , 'Last Qtr' , 'moon_21.gif' ) )
moons.sort(key=lambda x: x[0])
search_list_extension = {'nextmoons' : moons }
return [search_list_extension]
On Tuesday, 6 November 2018 07:27:02 UTC+11, Thomas Sch wrote:
>
>
>
> Am Montag, 5. November 2018 21:14:18 UTC+1 schrieb Thomas Sch:
>>
>> So I tested your solution but it says Waxing Moon. But we have waning
>> Moon currently.
>>
>> And $almanac.moon.next_full_moon.raw / $almanc.moon.next_new_moon.raw
>> didnt Work. I Gott the Error: cannot find "next_full_moon" while searching
>> for "almanac.moon.next_full_moon.raw"
>>
>> I Had to use $almanac.next_full_moon.raw / $almanac.next_new_moon.raw.
>>
>> In my best post I will Show you What I tryed.
>>
>
> With moon.html.tmpl I tested your solution gjr80. moon.html = output
> with test.html.tmpl I tested my current solution. test.html = output
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.