This is a Python quirk. The specification
*"%.1f" % -0.01*
always yields *'-0.0'*.
While there is no easy way to change this, there might be a workaround.
First, note that
*"%.1f" % (float("%.1f" % value) + 0.0)*
yields *'0.0'*, which is what you want. Apply this diff to weewx/units.py.
It should work for all float values, but I worry that somewhere out there
someone has created a skin that tries to format integers or even strings.
NOT TESTED.
===================================================================
diff --git a/src/weewx/units.py b/src/weewx/units.py
--- a/src/weewx/units.py (revision c7f1549acf69ee24f355616e161c3067e477422f)
+++ b/src/weewx/units.py (date 1762613730921)
@@ -781,10 +781,10 @@
format_string = useThisFormat
if localize:
# Localization requested. Use locale with the supplied
format:
- val_str = locale.format_string(format_string, val_t[0])
+ val_str = locale.format_string(format_string,
float(format_string % val_t[0]) + 0.0)
else:
# No localization. Just format the string.
- val_str = format_string % val_t[0]
+ val_str = format_string % (float(format_string % val_t[0])
+ 0.0)
# Add a label, if requested:
if addLabel:
On Sat, Nov 8, 2025 at 1:26 AM 'Tomasz Lewicki' via weewx-user <
[email protected]> wrote:
> I first asked the developers of the neowx-material skin, which I use to
> display data from my station, but I will repeat the question here, as it
> seems to be an internal Weewx issue.
>
> Sometimes I see a reading like the one in the screenshot below
> (non-graphic version: -0.0*C - minus zero point zero degree of Celsius). Of
> course, I guess this is due to the rounding of a value that is not visible.
> The question is, does this happen at the Weewx level (in which case I will
> ask on the weewx-user group), or can it be "fixed" in neowx-material?
>
> Since images cannot be attached to posts on the group, here is a link to a
> screenshot: https://imgur.com/a/r7KxBqN
>
> The answer was: "It is read by getVar, it looks for example like this
> $getVar(current.outTemp) or another variables like that. So I believe it is
> caused by weewx. And I agree that it is done by rounding some value, maybe
> it is like -0,01 or like that. In neowx-material it is done similar way as
> in for example official Seasons/current.inc" (
> https://github.com/seehase/neowx-material/issues/198#issuecomment-3504803216
> )
>
> And what do you think about that?
>
> --
> 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 visit
> https://groups.google.com/d/msgid/weewx-user/6ea43c98-0064-45e6-bf60-f7edbdc4c8d9n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/6ea43c98-0064-45e6-bf60-f7edbdc4c8d9n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 visit
https://groups.google.com/d/msgid/weewx-user/CAPq0zEC%3DuzhEeASqaRQ5dXD9ifLoAe9rZbP%3D5V9D5Y31vZgS%3DQ%40mail.gmail.com.