$almanac varying values

69 views
Skip to first unread message

Karen K

unread,
Nov 3, 2022, 5:28:41 PM11/3/22
to weewx-user
I was unsure about some results of the $alamanac tag. So I created a test template. It is very short. It calculates the sunrise time for June 21st, 2022:

$current.dateTime , $almanac(almanac_time=1655805600).sunrise

Every archive period a file is created out of that template. And I collected those files.

I would expect to get the same sunrise time all the time. But I don't. 

Could someone explain the reason for that behavior?

The different files for the different archive periods are (one line per file):

03.11.2022 15:40:00 , 04:52:07
03.11.2022 15:45:00 , 04:52:07
03.11.2022 15:50:00 , 04:52:06
03.11.2022 15:55:00 , 04:52:06
03.11.2022 16:00:00 , 04:52:06
03.11.2022 16:05:00 , 04:52:06
03.11.2022 16:10:00 , 04:52:06
03.11.2022 16:15:00 , 04:52:05
03.11.2022 16:20:00 , 04:52:05
03.11.2022 16:25:00 , 04:52:05
03.11.2022 16:30:00 , 04:52:05
03.11.2022 16:35:00 , 04:52:05
03.11.2022 16:40:00 , 04:52:05
03.11.2022 16:45:00 , 04:52:05
03.11.2022 16:50:00 , 04:52:04
03.11.2022 16:55:00 , 04:52:04
03.11.2022 17:00:00 , 04:52:04
03.11.2022 17:05:00 , 04:52:04
03.11.2022 17:10:00 , 04:52:04
03.11.2022 17:15:00 , 04:52:04
03.11.2022 17:20:00 , 04:52:04
03.11.2022 17:25:00 , 04:52:04
03.11.2022 17:30:00 , 04:52:04
03.11.2022 17:35:00 , 04:52:04
03.11.2022 17:40:00 , 04:52:04
03.11.2022 17:45:00 , 04:52:04
03.11.2022 17:50:00 , 04:52:04
03.11.2022 17:55:00 , 04:52:03
03.11.2022 18:00:00 , 04:52:03
03.11.2022 18:05:00 , 04:52:03
03.11.2022 18:10:00 , 04:52:03
03.11.2022 18:15:00 , 04:52:03
03.11.2022 18:20:00 , 04:52:03
03.11.2022 18:25:00 , 04:52:03
03.11.2022 18:30:00 , 04:52:03
03.11.2022 18:35:00 , 04:52:03
03.11.2022 18:40:00 , 04:52:04
03.11.2022 18:45:00 , 04:52:04
03.11.2022 18:50:00 , 04:52:04
03.11.2022 18:55:00 , 04:52:04
03.11.2022 19:00:00 , 04:52:04
03.11.2022 19:05:00 , 04:52:04
03.11.2022 19:10:00 , 04:52:04
03.11.2022 19:15:00 , 04:52:05
03.11.2022 19:20:00 , 04:52:04
03.11.2022 19:25:00 , 04:52:05
03.11.2022 19:30:00 , 04:52:04
03.11.2022 19:35:00 , 04:52:05
03.11.2022 19:40:00 , 04:52:05
03.11.2022 19:45:00 , 04:52:05
03.11.2022 19:50:00 , 04:52:05
03.11.2022 19:55:00 , 04:52:05
03.11.2022 20:00:00 , 04:52:05
03.11.2022 20:05:00 , 04:52:05
03.11.2022 20:10:00 , 04:52:05
03.11.2022 20:15:00 , 04:52:05
03.11.2022 20:20:00 , 04:52:05
03.11.2022 20:25:00 , 04:52:05
03.11.2022 20:30:00 , 04:52:05
03.11.2022 20:35:00 , 04:52:05
03.11.2022 20:40:00 , 04:52:05
03.11.2022 20:45:00 , 04:52:05
03.11.2022 20:50:00 , 04:52:05
03.11.2022 20:55:00 , 04:52:04
03.11.2022 21:00:00 , 04:52:04
03.11.2022 21:05:00 , 04:52:04
03.11.2022 21:10:00 , 04:52:04
03.11.2022 21:15:00 , 04:52:03
03.11.2022 21:20:00 , 04:52:03
03.11.2022 21:25:00 , 04:52:03
03.11.2022 21:30:00 , 04:52:02
03.11.2022 21:35:00 , 04:52:02
03.11.2022 21:40:00 , 04:52:02
03.11.2022 21:45:00 , 04:52:02
03.11.2022 21:50:00 , 04:52:02
03.11.2022 21:55:00 , 04:52:02
03.11.2022 22:00:00 , 04:52:02
03.11.2022 22:05:00 , 04:52:02


Tom Keffer

unread,
Nov 3, 2022, 6:42:17 PM11/3/22
to weewx...@googlegroups.com
Pressure and temperature also factor into the calculation. If you want to hold them constant as well, then use something like:

$current.dateTime , $almanac(almanac_time=1655805600, temperature=20.0, pressure=1010.0).sunrise

See the section Almanac in the Customizing Guide.

-tk

--
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/861c66cf-2db2-480f-9aa1-e54c2a6bbed6n%40googlegroups.com.

Karen K

unread,
Nov 4, 2022, 8:14:37 AM11/4/22
to weewx-user
tke...@gmail.com schrieb am Donnerstag, 3. November 2022 um 23:42:17 UTC+1:
Pressure and temperature also factor into the calculation. If you want to hold them constant as well, then use something like:

$current.dateTime , $almanac(almanac_time=1655805600, temperature=20.0, pressure=1010.0).sunrise

Could you say, where $almanac gets temperature and pressure from, if they are not provided by the user?
 

Tom Keffer

unread,
Nov 4, 2022, 8:38:42 AM11/4/22
to weewx...@googlegroups.com
If you provide almanac_time, then it looks them up in the database. Otherwise, it uses the last time stamp in the database.

If the database is not available, then it defaults to 15°C and 1010 mbar. 

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

Greg Troxel

unread,
Nov 4, 2022, 8:57:07 AM11/4/22
to Tom Keffer, weewx...@googlegroups.com

Tom Keffer <tke...@gmail.com> writes:

> If you provide almanac_time, then it looks them up in the database.
> Otherwise, it uses the last time stamp in the database.
>
> If the database is not available, then it defaults to 15°C and 1010 mbar.

I am curious about the rationale for 1010, vs 1013.25. And, barometric
vs station pressur for sunrise, or maybe it's really surface pressure at
the tangent point. But I get it that this delta is in the weeds, vs
980 and 1030 maybe being detectably different.

I have not attempted to average my pressures over multiple years to see
if that comes out at the standard pressure, which would be a blend of a
"average is different from standard" signal and calibration error.

signature.asc

Karen K

unread,
Nov 4, 2022, 11:42:26 AM11/4/22
to weewx-user
tke...@gmail.com schrieb am Freitag, 4. November 2022 um 13:38:42 UTC+1:
If you provide almanac_time, then it looks them up in the database. Otherwise, it uses the last time stamp in the database.


In my first example I provided an almanac_time. And there was a database record for that time. If it would use almanac_time to look into the database, I would guess it should get the same temperature and pressure for the same almanac_time all the time. But if so, why then vary the calculated sunrise values?

I am afraid it uses the actual temperature and pressure instead of that at almanac_time.
 

Tom Keffer

unread,
Nov 4, 2022, 12:01:25 PM11/4/22
to weewx...@googlegroups.com
This is a good point. I had it wrong. The value for almanac_time is used for the position of the heavenly body. The database lookup is done with whatever the "current  time" is, generally the last timestamp in the database.

So, to set both, you'd have to do something like:

$almanac(almanac_time=1655805600, temperature=$current(timestamp=1655805600).outTemp.raw, pressure=$current(timestamp=1655805600).barometer.raw).sunrise

Hopefully that works!

Are you just experimenting, or do you have a use case where you want the corrected sunrise at a specific time?

--
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 4, 2022, 1:36:55 PM11/4/22
to weewx-user
tke...@gmail.com schrieb am Freitag, 4. November 2022 um 17:01:25 UTC+1:
$almanac(almanac_time=1655805600, temperature=$current(timestamp=1655805600).outTemp.raw, pressure=$current(timestamp=1655805600).barometer.raw).sunrise

Hopefully that works!

It works perfect!
 
Are you just experimenting, or do you have a use case where you want the corrected sunrise at a specific time?


Additionally to the weather observations we use WeeWX to store and visualize the data of our photovoltaics system. There I am creating a table like the NOAA tables, showing sunrise and sunset time and the time the sun is up enough for photovoltaics and the energy production and also the energy consumption for the time when the sun is up and when the sun is down separately. When the sun is up we can use the energy directly out of the photovoltaics system. When the sun is down we need to use a battery storage system and/or buy energy from an electric power plant. So it seems useful to know at which time of day we consume how much energy.

Tom Keffer

unread,
Nov 4, 2022, 1:54:19 PM11/4/22
to weewx...@googlegroups.com
Makes sense. Sounds like for your application constant values for temperature and pressure would probably be best. 

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