Almanac extension

171 views
Skip to first unread message

Karen K

unread,
Nov 25, 2025, 9:44:10 AM (2 days ago) Nov 25
to weewx-user
I guess I did not announce the almanac extensions here, which are available from WeeWX 5.2 on.

There was a discussion some months ago about PyEphem becoming outdated and replaced by Skyfield. It resulted in making the WeeWX almanac extensible and providing an installable WeeWX extension based on Skyfield. This was done because Skyfield has more dependencies than PyEphem, and we did not want to add new dependencies to core WeeWX. The extension not only replaces the PyEphem based almanac, but also provides some additional attributes and events like:
  • solar date and time
  • apsides (the events when they take place)
  • Venus and Mercury phases
  • which constellation a star or planet is in
  • additional attributes for heavenly bodies
For a list of differences see PyEphem vs. Skyfield.

Additionally there is a second extension based on the first one which provides an actual sky map for the location of the weather station with Sun, Moon, the planets, stars, and -configurable - Earth satellites, as well as a symbol of the moon with realistic phase and tilt, and an analemma.

Here you find those extensions:

Pablo Sanchez

unread,
Nov 25, 2025, 10:15:20 AM (2 days ago) Nov 25
to weewx...@googlegroups.com
Thank you and everyone else who participated in the discussion. it is like an iceberg: all I see are two new extensions but behind the scenes, I can see (and appreciate!) the mental cycles behind the decision. Quite cool.
---
pablo


On 2025-11-25 09:44, Karen K wrote:
I guess I did not announce the almanac extensions here, which are available from WeeWX 5.2 on.

[ trimmed ]

Tom Hogland

unread,
Nov 25, 2025, 12:12:14 PM (2 days ago) Nov 25
to weewx-user
Love this and installed it per directions, except for using "--config=vp2.conf" and "--config=tempest.conf" in the weectl install line as I have two weather stations running. Tempest picked it up without error and is working, but the VP2 is giving an error - "ERROR user.skyfieldalmanac: live almanac error: unsupported operand type(s) for *: 'float' and 'NoneType'". This is the line where Tempest is showing pressure... 

Any thoughts? I've attached both .conf files and a run of logs from start through a complete second report cycle.

weewxd-vp2.log
tempest.conf
weewxd-tempest.log
vp2.conf

Tom Hogland

unread,
Nov 25, 2025, 12:12:29 PM (2 days ago) Nov 25
to weewx-user
Love this and installed it per directions, except for using "--config=vp2.conf" and "--config=tempest.conf" in the weectl install line as I have two weather stations running. Tempest picked it up without error and is working, but the VP2 is giving an error - "ERROR user.skyfieldalmanac: live almanac error: unsupported operand type(s) for *: 'float' and 'NoneType'". This is the line where Tempest is showing pressure... 

Any thoughts? I've attached both .conf files and a run of logs from start through a complete second report cycle.

On Tuesday, November 25, 2025 at 6:15:20 AM UTC-9 Pablo Sanchez wrote:
weewxd-vp2.log
tempest.conf
weewxd-tempest.log
vp2.conf

vince

unread,
Nov 25, 2025, 12:45:41 PM (2 days ago) Nov 25
to weewx-user
You might want to check your VP2 db to see if you have readings for pressure.

At first read I leapt to thinking it was the difference between barometer and pressure but I see you're using prefer_hardware for both in your VP2 .conf file so that looks ok I think. My VP2 database does have both elements FWIW.

$ echo "select datetime(dateTime,'unixepoch','localtime'),datetime,barometer,pressure from archive ORDER BY rowid DESC LIMIT 5;" | sqlite3 vp2.sdb
2025-11-25 09:35:00|1764092100|30.242|29.8328369985047
2025-11-25 09:30:00|1764091800|30.238|29.8296893509559
2025-11-25 09:25:00|1764091500|30.239|29.8306616771881
2025-11-25 09:20:00|1764091200|30.24|29.8316434818231
2025-11-25 09:15:00|1764090900|30.241|29.8326253020723


Also - your logs are throwing all kinds of errors related to not being able to find schemas, which I'm guessing is due to the 5.2 change in where things moved under the hood. Things like...
DEBUG weewx.manager: Could not load schema 'schemas.wview_extended.schema'

 See the Upgrade Guide (link) for that one, but I don't know if it's related or not.

Tom Hogland

unread,
Nov 25, 2025, 1:07:44 PM (2 days ago) Nov 25
to weewx-user
Running that sqlite command I get the same results you did - both values.

I did fix that schema error - changed 'schemas.' to 'weewx.schemas.' as it suggested and all is cleaned up. This has been running essentially unchanged since the early 4.x releases, maybe earlier, so that error could be years old :D Haven't addressed the localization file error in sftp but that's not high on the list at the moment.

I took out the debug=1 and restarted after that log extract, and still running along the same - Tempest is clean, VP2 shows that error every 5 minutes. 

Anything else I can gather to try to track this down?

Karen K

unread,
Nov 25, 2025, 2:45:11 PM (2 days ago) Nov 25
to weewx-user
Tom Hogland schrieb am Dienstag, 25. November 2025 um 18:12:29 UTC+1:
"ERROR user.skyfieldalmanac: live almanac error: unsupported operand type(s) for *: 'float' and 'NoneType'". This is the line where Tempest is showing pressure... 

There was a bug that caused an error if the pressure is missing. Please try the fix I provided some minutes ago.

John Smith

unread,
Nov 26, 2025, 4:00:17 AM (yesterday) Nov 26
to weewx...@googlegroups.com
I am trying to figure out how to use the new extension to give the next moon rise and set, however there isn't anything about that in the documentation or even the extension code, and I'm not sure how to do a dump of all information in the $almanac variable.

Also this log line is now misleading:

weewxd[12249]: INFO weewx.engine: 'pyephem' not detected, extended almanac data is not available

--
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/10824a8d-3c33-49d1-9008-e0cd1e08a6aan%40googlegroups.com.

Karen K

unread,
Nov 26, 2025, 8:58:35 AM (yesterday) Nov 26
to weewx-user
John Smith schrieb am Mittwoch, 26. November 2025 um 10:00:17 UTC+1:
I am trying to figure out how to use the new extension to give the next moon rise and set, however there isn't anything about that in the documentation or even the extension code, and I'm not sure how to do a dump of all information in the $almanac variable.

 There is no difference to the old almanac for that. 

$almanac.moon.next_rising
$almanac.moon.next_setting

John Smith

unread,
Nov 26, 2025, 9:14:43 AM (yesterday) Nov 26
to weewx...@googlegroups.com
Thanks, after looking closer at your code and a little trial and error I came up with the same solution...

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

Karen K

unread,
Nov 26, 2025, 10:04:46 AM (yesterday) Nov 26
to weewx-user
John Smith schrieb am Mittwoch, 26. November 2025 um 15:14:43 UTC+1:
Thanks, after looking closer at your code and a little trial and error I came up with the same solution...

There is documentation available: Customization of WeeWX using the weewx-skyfield-almanac extension. It reads at the beginning:

$almanac(almanac_time=time,            ## Unix epoch time
         lat=latitude, lon=longitude,  ## degrees
         altitude=altitude,            ## meters
         pressure=pressure,            ## mbars
         horizon=horizon,              ## degrees
         temperature=temperature_C     ## degrees C
       ).heavenly_body(use_center=[01]).attribute


So replace heavenly_body by the name of the body you want (like moon), and attribute by the appropriate attribute (like next_rising). Which bodies and attributes are avaiable, you find there, too.

John Smith

unread,
Nov 26, 2025, 10:37:20 AM (yesterday) Nov 26
to weewx...@googlegroups.com
I saw that example, but I was only after timestamps using details in the current archive record.

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

Tom Hogland

unread,
Nov 26, 2025, 11:14:05 AM (yesterday) Nov 26
to weewx-user
I didn't see anything from you about a bug prior to this, and nothing off-list. It also appears that pressure is there. Can you point me at what you're referring to?

Karen K

unread,
Nov 26, 2025, 2:32:11 PM (23 hours ago) Nov 26
to weewx-user
Tom Hogland schrieb am Mittwoch, 26. November 2025 um 17:14:05 UTC+1:
I didn't see anything from you about a bug prior to this, and nothing off-list. It also appears that pressure is there. Can you point me at what you're referring to?

 Please, download the updated version of the extension and install it, and then report, whether the problem is still there or gone. I did some changes that may address the problem.
Message has been deleted

John Smith

unread,
Nov 26, 2025, 10:55:32 PM (14 hours ago) Nov 26
to weewx...@googlegroups.com
Someone emailed me just then saying that they had an exception while using pyephem:

weewxd[1356]: ERROR weewx.cheetahgenerator: **** Reason: cannot find 'next_rise'

The template contains the following that caused the exception:
#if $almanac.hasExtras
$almanac.moon.next_rise.format("%H:%M %d")|$almanac.moon.next_set.format("%H:%M %d")|#slurp
#else
||#slurp
#end if

On Thu, 27 Nov 2025 at 00:58, Karen K <kk44...@gmail.com> wrote:
--
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.

michael.k...@gmx.at

unread,
Nov 26, 2025, 11:19:43 PM (14 hours ago) Nov 26
to weewx-user
Thanks for the extension. Will Skyfield interfere with an existing pyephem?

And why does the extension installer merge other skins lang files? This alters existing translations, imho not for the better. And if the other extension is updated, the merged files are overwritten anyway.

John Smith

unread,
Nov 26, 2025, 11:28:37 PM (14 hours ago) Nov 26
to weewx...@googlegroups.com
On Thu, 27 Nov 2025 at 15:19, 'michael.k...@gmx.at' via weewx-user <weewx...@googlegroups.com> wrote:
Thanks for the extension. Will Skyfield interfere with an existing pyephem?

A page comparing the 2 libraries mentions if both are installed Skyfield takes precedence... 

Karen K

unread,
12:43 AM (13 hours ago) 12:43 AM
to weewx-user
michael.k...@gmx.at schrieb am Donnerstag, 27. November 2025 um 05:19:43 UTC+1:
Thanks for the extension. Will Skyfield interfere with an existing pyephem?

No.
 
And why does the extension installer merge other skins lang files? This alters existing translations, imho not for the better. And if the other extension is updated, the merged files are overwritten anyway.
 
It does not alter existing translations. It adds words, that are not there so far.

There is one system of internationalization in WeeWX only, the $gettext tag. It receives the translations from the language files of the skin. If an extension adds things that include text, it has to look for the localized words in the skin's language files. The Sykfield almanac extension adds texts only that are specific to astronomy like planet names and constellation names and some labels. They are all not included in skins so far, so there is nothing to interfere with. Please, consider the altervative: then is would be necessary to have a long installation instruction involving the user to edit all those language files by hand and a lot of support issues from users who do not read instructions.

michael.k...@gmx.at

unread,
3:17 AM (10 hours ago) 3:17 AM
to weewx-user
It does in fact alter existing translations.

The skin I use has a lang/de.conf file, the contents of

[Almanac]

    # The labels to be used for the phases of the moon:
    moon_phases = Neumond, Zunehmender Sichelmond, Zunehmender Halbmond, Zunehmender Mond, Vollmond, Abnehmender Mond, Abnehmender Halbmond, Abnehmender Sichelmond

were overwritten during the merge when installing weewx-skyfield-almanac. Maybe there is an option to let the merge prefer existing keys, but this won't solve the issue that the merged configs will be overwritten by installing an updated version of the skin.

Since it is the users decision to install whatever extension, I'll let it up to the user to have translations for any skyfield related stuff. I'd never expect any extension to mess with the configs of another extension, it's asking for issues by design. As an extension author dealing with almanac stuff and celestial bodies, I'd prepare the translations in the extensions lang file, just as I did with pyephem before, for as long no other way providing augmenting translations exists. This would require an additional layer in the processing order under weewx/defaults.py and above skin.conf

Karen K

unread,
10:17 AM (3 hours ago) 10:17 AM
to weewx-user
michael.k...@gmx.at schrieb am Donnerstag, 27. November 2025 um 09:17:29 UTC+1: 
Since it is the users decision to install whatever extension, I'll let it up to the user to have translations for any skyfield related stuff. I'd never expect any extension to mess with the configs of another extension, it's asking for issues by design. As an extension author dealing with almanac stuff and celestial bodies, I'd prepare the translations in the extensions lang file, just as I did with pyephem before, for as long no other way providing augmenting translations exists. This would require an additional layer in the processing order under weewx/defaults.py and above skin.conf

Could you move those thoughts to an issue within the Skyfield almanac extension? That would be a better location to discuss the issue, I guess. 

Tom Hogland

unread,
10:43 AM (3 hours ago) 10:43 AM
to weewx-user
I checked and the version #'s hadn't changed - still 0.3 - but it appears something was updated. I re-downloaded and installed, restarted both instances and no more errors. Just as a thought, I might suggest bumping the version to 0.3.1 or similar, to make it obvious an update happened.

Thanks - working great!

Tom Hogland

unread,
10:43 AM (3 hours ago) 10:43 AM
to weewx-user
I checked and the version #'s hadn't changed - still 0.3 - but it appears something was updated. I re-downloaded and installed, restarted both instances and no more errors. Just as a thought, I might suggest bumping the version to 0.3.1 or similar, to make it obvious an update happened.

Thanks - working great!

Karen K

unread,
10:47 AM (3 hours ago) 10:47 AM
to weewx-user
Tom Hogland schrieb am Donnerstag, 27. November 2025 um 16:43:30 UTC+1:
I checked and the version #'s hadn't changed - still 0.3 - but it appears something was updated. I re-downloaded and installed, restarted both instances and no more errors. Just as a thought, I might suggest bumping the version to 0.3.1 or similar, to make it obvious an update happened.

It was a test for you to check only. So I did not change the version number, as this was no official version.
 

michael.k...@gmx.at

unread,
11:07 AM (2 hours ago) 11:07 AM
to weewx-user
Done. And I'm curious what other think about this, maybe my limited knowledge of things is the real problem :)
Reply all
Reply to author
Forward
0 new messages