Weewx how to put point instead of the comma ?

247 views
Skip to first unread message

Luigi Carbonera

unread,
Jun 18, 2018, 12:53:33 PM6/18/18
to weewx-user
Hello
As the title is how do you put the decimal point in place of the comma ?

Example I run a file and the result is this

10/06/18;19:40;27,6;1011,5;58;0,0;   N/A;0,0 ;0,0;0,0;18,4;WeeWX ;v3.8.0;32,7;41; 


Instead I would like that

10/06/18;19:40;27.6;1011.5;58;0.0;   N/A;0.0 ;0.0;0.0;18.4;WeeWX ;v3.8.0;32.7;41;


Thomas Keffer

unread,
Jun 18, 2018, 1:12:40 PM6/18/18
to weewx-user
That is normally controlled by the environment variable LANG.

For example, if you run weewxd using

LANG='es_ES.UTF-8' weewxd

the results will be appropriate for the Spanish language. 

Most of WeeWX works this way, but not all. What file are you trying to create?

-tk


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

Luigi Carbonera

unread,
Jun 18, 2018, 1:22:04 PM6/18/18
to weewx-user
This


$current.dateTime.format("%d/%m/%y");$current.dateTime.format("%H:%M");$current.outTemp.formatted;$current.barometer.formatted;$current.outHumidity.formatted;$current.windSpeed.formatted;$current.windDir.formatted;$current.windGust.formatted ;$current.rainRate.formatted;$day.rain.sum.formatted;$current.dewpoint.formatted;WeeWX ;v$station.version;$current.inTemp.formatted;$current.inHumidity.formatted;$current.UV.formatted;$current.radiation.formatted;

Thomas Keffer

unread,
Jun 18, 2018, 2:24:35 PM6/18/18
to weewx-user
All of the tag notations should follow what LANG you specify.

Andrew Milner

unread,
Jun 18, 2018, 9:27:14 PM6/18/18
to weewx-user
Tom
How do you override the language setting then??  The poster was getting a comma for the decimal point - which is correct for some European countries who use . for thousands and , for decimal separators.  

If, as in his case, he wants a file in the more usual decimal notation with , for thousands separator and . for decimal separator - is there an easy way to override the language setting of the computer just for the creation of the single file??

Thomas Keffer

unread,
Jun 18, 2018, 10:30:34 PM6/18/18
to weewx-user
There is an (undocumented) feature that allows you to bypass the localization process.

For example, you can use

$current.outTemp.toString($localize=False)

but using the "C" local (periods instead of commas for numbers).

Really, I need to revisit the tag formatting. When I wrote it (nearly 10 years ago) I wasn't as experienced with Cheetah. It could be greatly simplified. I've put up issue #328 to remind me.

-tk

Luigi Carbonera

unread,
Jun 19, 2018, 2:13:42 AM6/19/18
to weewx-user
Thank you so much !!
From a quick test it seems to work.
I calmly try all the data

19/06/18;08:05;22.6 °C;1019.9 mbar;74%;3.4 km/h;111 °;4.8 km/h ;0.0 mm/h;0.0 mm;17.7 °C;WeeWX ;v3.8.0;25.3 °C;60%;1.1;336 W/m²;

Il giorno martedì 19 giugno 2018 04:30:34 UTC+2, Thomas Keffer ha scritto:
There is an (undocumented) feature that allows you to bypass the localization process.

For example, you can use

$current.outTemp.toString($localize=False)

but using the "C" local (periods instead of commas for numbers).

Really, I need to revisit the tag formatting. When I wrote it (nearly 10 years ago) I wasn't as experienced with Cheetah. It could be greatly simplified. I've put up issue #328 to remind me.

-tk

19/06/18;08:05;22.6 °C;1019.9 mbar;74%;3.4 km/h;111 °;4.8 km/h ;0.0 mm/h;0.0 mm;17.7 °C;WeeWX ;v3.8.0;25.3 °C;60%;1.1;336 W/m²;

Andrew Milner

unread,
Jun 19, 2018, 2:22:23 AM6/19/18
to weewx-user
well it seems to have sorted out the decimal and comma - but given you a problem with the degree symbol!!  Guess you'll work that out somehow though!!!

I love it when Tom pops up with yet another 'undocumented' feature - shows how powerful weewx really is!!  Wish I had kept a catalogue of the ones he has come up with over the years!!

Thomas Keffer

unread,
Jun 19, 2018, 7:38:24 AM6/19/18
to weewx-user
There's a reason why they are undocumented!

The toString() function is very likely to change. Its parameter list is awkward and poorly named. So, if you use it, be prepared for it to break.

-tk

--

Luigi Carbonera

unread,
Jun 19, 2018, 7:45:53 AM6/19/18
to weewx-user
There is a problem in creating given temperature and solar


this is what I use

$current.dateTime.format("%d/%m/%y");$current.dateTime.format("%H:%M");$current.outTemp.toString($localize=False);$current.barometer.toString($localize=False);$current.outHumidity.toString($localize=False);$current.windSpeed.toString($localize=False);$current.windDir.nolabel("%.0f","-99999");$day.wind.max.toString($localize=False);$current.rainRate.toString($localize=False);$day.rain.sum.toString($localize=False);$current.dewpoint.toString($localize=False);weewx $station.version;$current.inTemp.toString($localize=False);$current.inHumidity.toString($localize=False);$current.UV.toString($localize=False);$current.radiation.toString($localize=False)


this is the one created

30.3 °C     ??
837 W/m&#178  ??

19/06/18;13:35;30.3 °C;1019.0 mbar;41%;9.3 km/h;254;22.5 km/h;0.0 mm/h);0.0 mm;15.5 °C;weewx 3.8.0;27.8 °C;50%;6.6;837 W/m&#178

Thomas Keffer

unread,
Jun 19, 2018, 8:26:27 AM6/19/18
to weewx-user
What did you want it to say? 

The degree and square signs cannot be encoded in ASCII. You must pick an alternate encoding such as HTML entities (the default and what was used), or UTF-8, or something else. See the section Encodings in the Customizing Guide.

-tk

Luigi Carbonera

unread,
Jun 19, 2018, 11:11:11 AM6/19/18
to weewx-user
It must generate a text file. ( file.txt )
The text file will be read automatically from a weather network
data separated by ; and decimals from point without ° C or mm or km / h
The perfect line would be this:

19/06/18;17:05;30.3 ;1019.0 ;41;9.3 ;254;22.5;0.0 ;0.0 ;15.5;weewx 3.8.0;27.8 ;50;6.6;837 ;

Thank you

Andrew Milner

unread,
Jun 19, 2018, 11:33:28 AM6/19/18
to weewx-user
…. then you probably want to be using the .nolabel option rather than .string

Thomas Keffer

unread,
Jun 19, 2018, 11:35:29 AM6/19/18
to weewx-user
Then use 

$current.outTemp.toString($addLabel=False, $localize=False)

Note that if the value is 'None', the string specified under [[StringFormats]], option "NONE" will be used:

[[StringFormats]]
  ...
  NONE = " N/A"

If you want to override that as well, then

$current.outTemp.toString($addLabel=False, $localize=False, $NONE_string="")

The toString() function is pretty powerful. I really should document it!

-tk

Luigi Carbonera

unread,
Jun 19, 2018, 3:52:15 PM6/19/18
to weewx-user
Thanks so much !!

I solved with this

$current.outTemp.toString($localize=False,$addLabel=False)

$current.dateTime.format("%d/%m/%y");$current.dateTime.format("%H:%M");$current.outTemp.toString($localize=False,$addLabel=False);$current.barometer.toString($localize=False,$addLabel=False,$NONE_string="");$current.outHumidity.toString($localize=False,$addLabel=False,$NONE_string="");$current.windSpeed.toString($localize=False,$addLabel=False,$NONE_string="");$current.windDir.nolabel("%.0f","-99999");$day.wind.max.toString($localize=False,$addLabel=False,$NONE_string="");$current.rainRate.toString($localize=False,$addLabel=False,$NONE_string="");$day.rain.sum.toString($localize=False,$addLabel=False,$NONE_string="");$current.dewpoint.toString($localize=False,$addLabel=False,$NONE_string="");weewx $station.version;$current.inTemp.toString($localize=False,$addLabel=False,$NONE_string="");$current.inHumidity.toString($localize=False,$addLabel=False,$NONE_string="");$current.UV.toString($localize=False,$addLabel=False,$NONE_string="");$current.radiation.toString($localize=False,$addLabel=False,$NONE_string="")

I'm really happy

19/06/18;21:50;25.2;1018.5;62;2.7;318;22.5;0.0;0.0;17.4;weewx 3.8.0;29.2;49;0.0;0

Thanks so much

Luigi
Reply all
Reply to author
Forward
0 new messages