Short answer re rain units is it depends. Rain is recorded in the database 
using the rain units of the unit system used by the database. The unit 
system of the database used by a WeeWX instance is specified by the 
[StdConvert] 
target_unit setting in weewx.conf. Possible unit systems are US (the 
default), Metric or MetricWx. The US unit system records rain in inches, 
Metric records rain in cm and MetricWx records rain in mm. If you have a 
WeeWX database but don't have the corresponding weewx.conf used with the 
database you can look at the usUnits column in the archive table in the 
database. If each row contains the value 1 the database uses the US unit 
system, a value of 16 means the database uses the Metric unit system and a 
value of 17 means the database uses the MetricWx unit system.

The wsum column in the archive_day_rain table contains the weighted sum of 
all archive record rainfall values for the day concerned (probably better 
described as the sum of all weighted archive record rainfall values for the 
day concerned). The weighted rainfall for an archive interval is obtained 
by multiplying the rainfall recorded in the archive interval by the archive 
interval. The wsum column is used when calculating aggregates for 
observations when the archive interval is not constant (some history; 
initially WeeWX required all archive records to have the same archive 
interval, later this restriction was relaxed and the wsum column was 
implemented to ensure meaningful aggregates could still be calculated). The 
wsum column is typically used for observations where you are interested in 
the daily average, eg daily average temperature, humidity etc where your 
archive table consists of records with differing archive intervals (if you 
did not use a weighted sum short period high or low values could skew the 
aggregate). For rainfall the typical aggregate of interest is the sum which 
is independent of the archive interval and hence the wsum column in itself 
is largely meaningless and can be ignored. By the sounds of your 
investigation the sum values are correct.

Gary
On Sunday, 4 May 2025 at 19:49:15 UTC+12 Tomasz Lewicki wrote:

> Further to my earlier thread about deleting or modifying values in the 
> database (https://groups.google.com/g/weewx-user/c/EN_elfqKhlI), I would 
> like to understand in what units precipitation is expressed. I am comparing 
> the current and previous records of precipitation values in the station 
> software and in Weewx, and I cannot reconcile them in any way. For 24 
> hours, my station recorded 15 mm of precipitation, while the wsum field in 
> the archive_day_rain table shows 1588.2. What does this mean?
>
> I found a thread titled "Weewx WD Import - Rain data units, values" (
> https://groups.google.com/g/weewx-user/c/Umc6L8NqXvc), but did not find 
> an answer to my question there.
>
> I summed the rainfall data for the whole day from the database using the 
> query (1746223200 = 2025-05-03 00:00:00 localtime, 1746309600 = 2025-05-04 
> 00:00:00 localtime) and exported it to a CSV file:
>
> select datetime(dateTime,'unixepoch','localtime'),dateTime,rain from 
> archive where dateTime < 1746309600 and dateTime >= 1746223200;
>
> Another query:
>
> select sum(rain) from archive where dateTime < 1746309600 and dateTime >= 
> 1746223200;
>
> Summing the rainfall both ways from the 'rain' column in the 'archive' 
> array gave me the same value as 'sum' in the 'archive_day_rain' array. 
> Where then did the value of 1588.2 in the wsum column come from?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/278a7a18-84e9-40d4-a0a6-aa64827f8c62n%40googlegroups.com.

Reply via email to