Increase/decrease in length of the day

167 views
Skip to first unread message

Dan Hinckley

unread,
Jan 17, 2025, 8:24:16 AM1/17/25
to weewx...@googlegroups.com
Before I try to cook it up myself, has anyone developed a way to show how much longer/shorter today is than the previous day?

michael.k...@gmx.at

unread,
Jan 17, 2025, 9:09:32 AM1/17/25
to weewx-user
I don't know if you can obtain the value directly, but you should be able to do it based on almanac
https://weewx.com/docs/5.1/custom/cheetah-generator/?h=almanac#almanac
when you subtract today's value from yesterday's, you have the delta.

Tom Keffer

unread,
Jan 17, 2025, 9:19:44 AM1/17/25
to weewx...@googlegroups.com
The standard "Seasons" skin already includes that. It's implemented using the following, which you can put in your skin. You need pyephem for it to work.

  ## For the change in daylight, pick a string to indicate whether it is more or
## less than yesterday:
#set $sun_visible_change = $almanac.sun.visible_change
#if $sun_visible_change.raw < 0
#set $change_str = $gettext("less than yesterday")
#else
#set $change_str = $gettext("more than yesterday")
#end if
#end if
This is then used in a table:
<tr>
<td class="label">$gettext("Total daylight")</td>
<td class="data">$almanac.sun.visible.long_form<br/>$sun_visible_change.long_form $change_str</td>
</tr>


On Fri, Jan 17, 2025 at 5:24 AM Dan Hinckley <d...@suiattle.org> wrote:
Before I try to cook it up myself, has anyone developed a way to show how much longer/shorter today is than the previous day?

--
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 visit https://groups.google.com/d/msgid/weewx-user/D3805510-28BD-4F30-8837-52699E65F64B%40suiattle.org.

weather list

unread,
Jan 17, 2025, 9:45:43 AM1/17/25
to weewx...@googlegroups.com

weather list

unread,
Jan 17, 2025, 1:53:12 PM1/17/25
to weewx...@googlegroups.com
Actually, I'd like to say "Today is xx minutes longer/shorter than yesterday."

Is $sun_visible_change.raw expressed in minutes or seconds?

On 17 Jan, 2025, at 09:19, Tom Keffer <tke...@gmail.com> wrote:

Tom Keffer

unread,
Jan 17, 2025, 2:21:05 PM1/17/25
to weewx...@googlegroups.com
Almost everything in WeeWX is in seconds. The only exception that I can think of right now is the archive interval stored in the database, which is in minutes.

-tk


weather list

unread,
Jan 17, 2025, 3:14:24 PM1/17/25
to weewx...@googlegroups.com
Your example did what I need, I just hadn't put it in properly; now working. Thank you.

DR

unread,
Jul 5, 2026, 10:36:22 AM (13 hours ago) Jul 5
to weewx...@googlegroups.com

Is there an ideal or best place to insert this code for generating the data?


The table display portion is obvious to me, but wonder where this is best inserted? Thanks.  Dale

Vince Skahan

unread,
Jul 5, 2026, 1:33:21 PM (10 hours ago) Jul 5
to weewx-user
Not understanding what you're trying to accomplish with such skeletal wording.

There's no "best".  Whatever gets you the result you want is best.

DR

unread,
Jul 5, 2026, 1:49:41 PM (10 hours ago) Jul 5
to weewx...@googlegroups.com
As I read it, the code for determining length of day and the selection
of longer or shorter boilerplate phrase needs to be done once a day.


To me, best is making sure the code gets executed near the beginning of
each day, but not run more than needed.  So putting it inside the
reading of loop packets is wasteful, which is as you've said not as much
of a problem as it used to be with the faster processors now.


Let me ask:  Are you running this code to do this additional tweak to
make WeeWx even nicer?  If you are, where did you put your snippet,
efficient or not?


The table display, as I mentioned, belongs in the current.inc, but I
don't know where to put the other code.  Can you help?  If you don't run
this add  in, but have a guess as to where it might be evaluated, can
you share?

Dale


Vince Skahan

unread,
Jul 5, 2026, 5:06:05 PM (7 hours ago) Jul 5
to weewx-user
If you surf the belchertown-new github you will find a file daylight.inc that works for me. It is included by one line in index.html.tmpl

You can take the same approach with whatever skin you wish to add 

DR

unread,
Jul 5, 2026, 6:01:24 PM (6 hours ago) Jul 5
to weewx...@googlegroups.com
Thanks, I'm off to see if it will work for me.

I take it from the message by Tom Keffer that his solution didn't depend
upon Belchertown being installed, but perhaps the  info you refer to
will clarify for me. Again, thanks. Dale


Tom Keffer

unread,
Jul 5, 2026, 6:20:20 PM (6 hours ago) Jul 5
to weewx...@googlegroups.com
The snippet I posted requires only that pyephem be installed. Everything else comes with generic WeeWX. The snippet can be included anywhere.

I should note that my cut-and-paste wasn't chosen very well. The Cheetah logic includes a closing "#end if", but not the opening "#if". The correct snippet would look like:
## If extended almanac information is available, calculate change in daylight.
#if $almanac.hasExtras

## For the change in daylight, pick a string to indicate whether it is more or
## less than yesterday:
#set $sun_visible_change = $almanac.sun.visible_change
#if $sun_visible_change.raw < 0
#set $change_str = $gettext("less than yesterday")
#else
#set $change_str = $gettext("more than yesterday")
#end if
#end if
The HTML is as before.


--
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.
Reply all
Reply to author
Forward
0 new messages