Hi,

Dealing with units is not covered in the Adding a second data source 
<http://weewx.com/docs/customizing.htm#Adding_2nd_source> section of the 
Customization Guide. The simple rule of thumb regarding adding data to an 
existing record is that you should make sure you observe the units group 
specified by the usUnits field in the record you are adding data to. For 
example, a driver may produce a loop packet that contains temperature data 
in C (perhaps that is the native temperature units of the sensor), if you 
have another service that adds another temperature field to that loop 
packet you can't assume that the loop packet will contain temperatures in F 
or C (the user may change stations and use a different driver that now 
outputs in F). What you should do is check the value of the usUnits field 
in the loop packet and that will tell you what unit group the packet uses 
and from that you can tell whether temperatures are in C or F. It is then 
up to your service to add your data using the appropriate units. You must 
do this when adding data that could use different units depending on the 
unit system otherwise your data will quite possibly be incorrectly 
converted somewhere by WeeWX. Of course, if the same units are used for 
your observation type across all WeeWX units systems (eg humidity - %) then 
you can safely ignore the usUnits field and add your data unchanged.

It is true that the default unit system used by the WeeWX database is US 
customary, but you cannot assume that US customary units are used 
everywhere in WeeWX even if the database is in US customary units. The 
StdConvert service will convert the loop packet/archive record to the same 
unit system as used by the database, but up until then you do not know what 
unit system the loop and archive data uses so hence the need to check 
usUnits. Even after StdConvert I would still be checking the unit system of 
the data record you are working with.

I hoe this helps.

Gary

On Monday, 4 February 2019 03:06:01 UTC+10, engolling wrote:
>
> Hello Thomas,
> thank you for your feedback - indeed i made a mistake assigning the unit 
> groups, this led to that strange behaviour.
> Am I right, if I say that all values has to be imported as USUnit?
> I did not find this info in the customization guide. In combination with 
> my error everything was strange suddenly.
>
> Thank you,
> engolling
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to