I can think of two ways of doing this.

   1. Use the text in $almanac.moon_phase
   2. Use the undocumented tag $almanac.moon_index. It is the index into
   moon_phase and varies from 0 to 7.

Here's their relationship:

$almanac.moon_index  $almanac.moon_phase
        0                 New
        1                 Waxing crescent
        2                 First quarter
        3                 Waxing gibbous
        4                 Full
        5                 Waning gibbous
        6                 Last quarter
        7                 Waning crescent

Approach #1 has the advantage of being documented. It has the disadvantage
that it would be sensitive to localization. For example, you would have to
change it if you changed language to French.

#if $almanac.moon_phase == "Waxing crescent"
  <img href="increasing_crescent.png"/>
#elif $almanac.moon_phase == "Waning crescent"
  <img href="decreasing_crescent.png"/>
  ...

Approach #2 is similar, but you just use the index. It is undocumented, but
unlikely to change.

#if $almanac.moon_index == 1
  <img href="increasing_crescent.png"/>
#elif $almanac.moon_index == 7
  <img href="decreasing_crescent.png"/>
  ...

Hope this helps.

-tk

On Fri, Nov 2, 2018 at 3:57 AM Thomas Sch <[email protected]>
wrote:

> I am working on a template that shows a picture of the moon for every
> percent of moon fullness. My Problem: for example: when I say
>
> #if $almanac.moon_fullness = 50
> ...
>
>
> I will get 2 pictures of the moon. One of the increasing and one of the
> decreasing moon.
>
> Is there a solution that ephem shows me the trend of the moon "crescent"
> or "wanning" or something else.
>
> for example:
>
> If $almanac.moon_fullness = 50 and $almanac.moon_trend = "crescent"
> ...
>
> I Hope anyone can help me. And sorry for my bad English.
>
> --
> 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.
>

-- 
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.

Reply via email to