I'm not exactly sure what you want to do, but take a look through the
convenience functions at the bottom of weewx/units.py. It may be as simple
as:

record_metric = weewx.units.to_METRICWX(record)


But, if your goal is to emit JSON formatted output, be sure to look through
the wiki article *Tags for series
<https://github.com/weewx/weewx/wiki/Tags-for-series>*. WeeWX may be able
to do what you want already!

On Sun, Sep 8, 2024 at 5:52 PM Vince Skahan <[email protected]> wrote:

> I'm working on an app that reads the archive and loop data as it comes in
> and emits JSON-formatted output.  I want to make sure to always convert
> that data to metric values.
>
> Is there a weewx-ish standard way to take a speed and always generate mps
> ?  Or a temperature and always emit degC, and so on ?
>
> I didn't see any mph=>mps conversion routines but that's easy of course.
> What I wasn't certain on was how to decide from the packet/record if that
> conversion needed to be done, given how configurable weewx is for setting
> unit systems on a field by field basis ?
>
> Any suggestions or examples I might look at ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-development" 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-development/47b87add-2c44-40cc-9979-6c2e18a36d35n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/47b87add-2c44-40cc-9979-6c2e18a36d35n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" 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-development/CAPq0zEBoFhKjm2b09_oBxMFRqH3sV2SYOEZz4dCFWB1z5ZxxWA%40mail.gmail.com.

Reply via email to