Calculation of the barometer value in WeeWX

409 views
Skip to first unread message

Karen K

unread,
Jun 24, 2023, 6:59:44 AM6/24/23
to weewx-user
The wiki page Barometer, pressure, and altimeter says, that calculating the barometer value "requires the temperature 12 hours ago in order to correct for diurnal tide effects."

In contrary in the weewx.wxxtypes.PressureCooker.barometer() function the actual temperature is used only. There is no database access.

Could someone explain, what the reference to temperature 12 hours ago in the wiki means?

Greg Troxel

unread,
Jun 24, 2023, 9:43:23 AM6/24/23
to Karen K, weewx-user
Karen K <kk44...@gmail.com> writes:

> The wiki page Barometer, pressure, and altimeter
> <https://github.com/weewx/weewx/wiki/Barometer,-pressure,-and-altimeter> says,
> that calculating the barometer value "requires the temperature 12 hours ago
> in order to correct for diurnal tide effects."
>
> In contrary in the weewx.wxxtypes.PressureCooker.barometer() function the
> actual temperature is used only. There is no database access.
>
> Could someone explain, what the reference to temperature 12 hours ago in
> the wiki means?

My understanding is that the strict definition of "barometric pressure"
is a reduction to sea level, starting with sea level, and using a time
average of temperature. However, I suspect that in many cases it is
done with current temp only.

I have the impression that strictly one might need the future temp, but
I am very unclear on that.

Hope this helps if you try to chase down real definition (WMO, national
weather agencies).

Karen K

unread,
Jun 25, 2023, 1:12:37 AM6/25/23
to weewx-user
Greg Troxel schrieb am Samstag, 24. Juni 2023 um 15:43:23 UTC+2:
Hope this helps if you try to chase down real definition (WMO, national
weather agencies).

Indeed. The German Weather Service (DWD) offers a formula in their specification for weather data transmission (VuB 2 Wetterschlüsselhandbuch binäre Schlüssel BUFR). No mention of past or forecasted temperature values. They simply use the actual temperature. 

And as they have to obey the regulations of the WMO, the WMO may have no more sophisticated definition.

It is all some way confusing. 

gszla...@gmail.com

unread,
Jul 5, 2023, 9:37:16 AM7/5/23
to weewx-user
Interesting comment that WeeWX uses current temperature only. Perhaps Tom can confirm. Does WeeWX use current temp or the 12 hour average?

MSLP calculations are country specific. In North America 12 hr temperature averages are used.

Why? Dr. David Burch author of "The Barometer Handbook" has the best explanatiion:

...This 12-hr time average is not an obvious choice. It is also not the result of a mathematical theory, but we can expect that some average is called for. We know the virtual temperature of this virtual air column affects the pressure, and it is reasonable to assume that the the pressure at the base of this column cannot respond instantly to a change in temperature at the top, so we are led to averaging over some time period to reach equilibrium. In other words, the air temperature at the moment is not what we should use to project this pressure down to the sea level, but rather some average of what it has been in the recent past.

For instance, In the UK current temperature is used instead of the average and humidity is excluded as well from the equation. In Germany, it appears that current temperature is used.

Hope this helps...

Karen K

unread,
Jul 5, 2023, 10:03:33 AM7/5/23
to weewx-user
gszla...@gmail.com schrieb am Mittwoch, 5. Juli 2023 um 15:37:16 UTC+2:
Interesting comment that WeeWX uses current temperature only. Perhaps Tom can confirm. Does WeeWX use current temp or the 12 hour average?

To be precise: It uses the current temperature, if it calculates the sealevel pressure out of the station pressure. It uses the temperature 12 hours ago together with the current temperature, if it calculates the station pressure out of the sealevel pressure.

pressure to barometer from wxxtypes.py:

barometer-from-pressure.png 

pressure from barometer from wxxtypes.py:
pressure-from-barometer.png

(Sorry, I found no other way than to use a screenshot.)

gszla...@gmail.com

unread,
Jul 5, 2023, 7:31:31 PM7/5/23
to weewx-user
Very interesting. For US-centric SLP/MSLP calculaions I would have thought that 12 hour temp averages would always be used;
Again, from Dr. Burch: T (avg) = [ T(0h) + T(-12h) ]  ÷ 2. He did a study on this comparing QFF results using T(0h) and another data set using T(avg) and remarks "..[our] study is remarkable evidence that we must use the average temperature over the past 12h when correcting QNH to get QFF".

Why would one want to convert QFF/SLP back down to station pressure? 

I don't have a Davis weather station but could it be that Davis VP2 consoles send SLP to WeeWX and then WeeWX converts it back to station pressure so that WeeWX can calculate both Altimeter and SLP??. If a Davis console is set to zero elevation what is sent to WeeWX?. I am guessing raw station pressure and then again, WeeWX calculates Altimeter and SLP. from station pressure.  Did I get that right?

Tom Keffer

unread,
Jul 5, 2023, 8:55:10 PM7/5/23
to weewx...@googlegroups.com
On Wed, Jul 5, 2023 at 4:31 PM gszla...@gmail.com <gszla...@gmail.com> wrote:
Very interesting. For US-centric SLP/MSLP calculaions I would have thought that 12 hour temp averages would always be used;
Again, from Dr. Burch: T (avg) = [ T(0h) + T(-12h) ]  ÷ 2. He did a study on this comparing QFF results using T(0h) and another data set using T(avg) and remarks "..[our] study is remarkable evidence that we must use the average temperature over the past 12h when correcting QNH to get QFF".

Why would one want to convert QFF/SLP back down to station pressure? 

I don't have a Davis weather station but could it be that Davis VP2 consoles send SLP to WeeWX and then WeeWX converts it back to station pressure so that WeeWX can calculate both Altimeter and SLP??. If a Davis console is set to zero elevation what is sent to WeeWX?. I am guessing raw station pressure and then again, WeeWX calculates Altimeter and SLP. from station pressure.  Did I get that right?

Pretty much.

CWOP demands altimeter, which, until Davis introduced "LOOP2" packets, the Vantage series did not emit. So, it had to be backcalculated from the types at hand, which was barometer.

This was about 10 years ago, and I don't remember the provenance of the formula. It could be from wview. 

I would be very surprised if the formulas are the inverse of each other. If someone wants to work on that, it would be appreciated.

-tk

Karen K

unread,
Jul 6, 2023, 2:26:14 AM7/6/23
to weewx-user
Tom Keffer schrieb am Donnerstag, 6. Juli 2023 um 02:55:10 UTC+2:
This was about 10 years ago, and I don't remember the provenance of the formula. It could be from wview. 

You documented it. 

The formula to get the sealevel pressure out of the station pressure is found in wxformulas.py and there the comment says "This implementation was copied from wview." 

The formula to get the station pressure out of the sealevel pressure is found in uwxutils.py. There the comments say, it is derived from some set of formulae written by Steve Hatchett in Pascal, which you converted into Python.

Karen K

unread,
Jul 7, 2023, 1:21:02 AM7/7/23
to weewx-user
There is calm weather now. No wind. A High is nearby. I created a little test skin to compare the barometer. The readings marked "DWD" are from governmental stations.

Luftdruckvergleich-2023-07-07.png

You see the measured station pressure (QFE) and the sealevel pressure according to the WeeWX formula and the DWD formula. There are remarkable differences I would say. Carlsfeld and the mount Fichtelberg are 27 km away from each other only, but the altitude is different. Holzhausen (Leipzig) and the mount Fichtelberg are 100 km away from each other, and the altitude is very different.

Karen K

unread,
Jul 7, 2023, 2:00:24 PM7/7/23
to weewx-user

Karen K

unread,
Jul 12, 2023, 5:43:32 AM7/12/23
to weewx-user
For general information: That pull request was closed. Tom is right when he stated that this is not the right way to do it. And the right way is not possible in the moment. If someone wants to experiment, try this.
Reply all
Reply to author
Forward
0 new messages