IIRC, When your driver creates loop and archive observations, you need to set usUnits to reflect the correct system. For example, the vantage drive sets: 'usUnits': weewx.US In the loop data and archive records. If custom driver is in metric, set: ‘UsUnits’: weewx.METRIC If you do this, weewx will do the conversions and store values in the database in the system you specified when you created the database. But there is more. You have to use the correct metric units. To do this, see the weewx/units.py file. Look up the observation in that file, find the group, and then look up what that group expects. For example, rain is: "rain" : "group_rain", And, if you look up group_rain for metric, you’ll find group_rain is expecting cm: "group_rain" : "cm", # This dictionary maps unit groups to a standard unit type in the # metric unit system: MetricUnits = ListOfDicts({ "group_altitude" : "meter", "group_amp" : "amp", "group_angle" : "degree_angle", "group_boolean" : "boolean", "group_concentration": "microgram_per_meter_cubed", "group_count" : "count", "group_data" : "byte", "group_db" : "dB", "group_degree_day" : "degree_C_day", "group_deltatime" : "second", "group_direction" : "degree_compass", "group_distance" : "km", "group_elapsed" : "second", "group_energy" : "watt_hour", "group_energy2" : "watt_second", "group_fraction" : "ppm", "group_frequency" : "hertz", "group_illuminance" : "lux", "group_interval" : "minute", "group_length" : "cm", "group_moisture" : "centibar", "group_percent" : "percent", "group_power" : "watt", "group_pressure" : "mbar", "group_pressurerate": "mbar_per_hour", "group_radiation" : "watt_per_meter_squared", "group_rain" : "cm", "group_rainrate" : "cm_per_hour", "group_speed" : "km_per_hour", "group_speed2" : "km_per_hour2", "group_temperature" : "degree_C", "group_time" : "unix_epoch", "group_uv" : "uv_index", "group_volt" : "volt", "group_volume" : "liter" }) On Oct 2, 2024, at 7:51 PM, Thomas Carlin <[email protected]> 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/7862DA18-FA9F-4B63-88AF-C8355C8D3AC2%40johnkline.com. |
- [weewx-user] Convert values before loading int... Thomas Carlin
- Re: [weewx-user] Convert values before lo... 'John Kline' via weewx-user
- Re: [weewx-user] Convert values befor... Graham Eddy
- Re: [weewx-user] Convert values befor... Tom Keffer
- Re: [weewx-user] Convert values b... Thomas Carlin
- Re: [weewx-user] Convert valu... Graham Eddy
- Re: [weewx-user] Convert... Thomas Carlin
- Re: [weewx-user] Con... Graham Eddy
