Page 1 of 2

[Implemented] Webtag parameter for rounding

Posted: Fri 21 Aug 2020 4:44 pm
by freddie
Is it possible to have a parameter that allows you to round output to a number of decimal places (including none) for tags that generate numeric output?

Re: Webtag parameter for rounding

Posted: Fri 21 Aug 2020 5:49 pm
by rogerthn

Re: Webtag parameter for rounding

Posted: Fri 21 Aug 2020 6:04 pm
by freddie
Yes, I've seen that. But it only works for certain tags - hence the request for it to be extended to all numeric tags.

Re: Webtag parameter for rounding

Posted: Fri 21 Aug 2020 6:53 pm
by rogerthn
Whoops, I should have read the title Cumulus MX Development Suggestions

Re: Webtag parameter for rounding

Posted: Sat 22 Aug 2020 9:06 am
by mcrossley
I'll take a look, but with over 700 tags it sounds like a lot of typing may be involved! :roll: So it maybe a back burner one for now.

Re: Webtag parameter for rounding

Posted: Sat 22 Aug 2020 9:18 am
by freddie
Sounds like an ideal candidate for an abstract parent class that the tags can inherit from - if tags are modelled using classes. I'm happy to do it - it's my bread and butter :-)

Re: Webtag parameter for rounding

Posted: Sat 22 Aug 2020 11:11 am
by mcrossley
freddie wrote: Sat 22 Aug 2020 9:18 am if tags are modelled using classes.
You'd wish!
v4 is very different (if we ever see it), but no, v3 is a function per tag.

Re: Webtag parameter for rounding

Posted: Sat 22 Aug 2020 11:54 am
by freddie
Yes, I can see that now.

I've made the changes in a local copy of MX and they are running on my website https://www.hosiene.co.uk/weather/

I have only changed #wlatest, #wspeed and #wgust, as they are the ones I was interested in. Happy to do more, though - but it is really the wind speed ones I am interested in. I like the single decimal point for averages, but for instantaneous values I prefer rounded numbers.

Currently in MX you either have all rounded or all to 1 dp.

Let me know if you are interested in the changes and I will give them to you.

Re: Webtag parameter for rounding

Posted: Sat 22 Aug 2020 12:41 pm
by mcrossley
Now, should they be rounded or truncated to integers, the latter I think.

And, yes I use 1dp for wind average, and the integer value for latest, gust - as supplied by the VP2

Re: Webtag parameter for rounding

Posted: Sat 22 Aug 2020 1:09 pm
by freddie
mcrossley wrote: Sat 22 Aug 2020 12:41 pm Now, should they be rounded or truncated to integers, the latter I think.

And, yes I use 1dp for wind average, and the integer value for latest, gust - as supplied by the VP2
Definitely rounded. 24.9 knots is more 25 knots than 24 :)
Latest gust converted to knots ends up a non-integer.

Re: Webtag parameter for rounding

Posted: Fri 26 Mar 2021 10:13 am
by mcrossley
Implemented - you can now also set the decimals globally via the station settings page.

Re: [Implemented] Webtag parameter for rounding

Posted: Fri 26 Mar 2021 1:32 pm
by freddie
Awesome, thanks Mark. In my custom MX builds I have been using (for example):

Code: Select all

<#wspeed dp=0>
This will work now with the build untouched?

Also, for zero decimal places, are values rounded or truncated?

Re: [Implemented] Webtag parameter for rounding

Posted: Fri 26 Mar 2021 1:49 pm
by mcrossley
It is implemented globally rather than per tag. So you can set the number of dp for wind speed (current, gust), wind run, and wind average independently of each other in the settings.
All other units also have their own dp settings.

Re: [Implemented] Webtag parameter for rounding

Posted: Fri 26 Mar 2021 2:15 pm
by ConligWX
Hmm nice touch! though I thought Mark you only worked in Binary.

either the value of 1 or 0 would suffice :lol:

Re: [Implemented] Webtag parameter for rounding

Posted: Fri 26 Mar 2021 2:33 pm
by freddie
Okay, so that looks as if it will be storing in whatever precision you pick in the settings. So if you pick speed as 0 decimal places then it will be stored that way?