Page 1 of 1

<temptrend> - difference in realtime.txt and websitedata.json

Posted: Sat 15 Oct 2022 11:04 am
by Dador
Hi,

I noticed that there is a difference in the presentation of data for the <temptrend> and <presstrendval> tags in realtime.txt and websitedata.json.

In realtime.txt if the trend is positive, there is a "+" in front of the value, but not in websitedata.json it. Conversely, if the trend is negative, then "-" is here and here. Why?

For example, my files:
https://cmx.pogodarybnik.pl/realtime.txt
https://cmx.pogodarybnik.pl/websitedata.json

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sat 15 Oct 2022 11:14 am
by water01
Presumably the code assumes it is positive unless there is a negative sign in front of it?

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sat 15 Oct 2022 11:54 am
by mcrossley
realtime.txt uses a text string, websitedata uses a numeric value.

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sat 15 Oct 2022 3:36 pm
by Dador
mcrossley wrote: Sat 15 Oct 2022 11:54 am realtime.txt uses a text string, websitedata uses a numeric value.
Ok, but for example the tag <TempChangeLastHour> works fine in json, i.e. as it grows it is +, as it falls it is - in front of a numerical value.
So I don't see any consistency in CMX when it comes to presenting trend data.

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sat 15 Oct 2022 7:55 pm
by mcrossley
So, websitedata.json does not contain <#temptrend> :?

It does contain <#TempChangeLastHour>, and that is a string and does have a leading "+" if positive.

So, I'm not sure what the problem is?

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sat 15 Oct 2022 9:02 pm
by Dador
I believe that whether there is a + or - sign before the value matters.
Let's see the picture below.

Image

Suppose a visitor comes to my page where I have a CMX template and data from websitedata.json and sees such data. What thinks? He knows that there has been a change in pressure, but he does not know whether it is falling or rising (assuming that he does not know Polish and does not translate the page through a translator).

If the value was -0,4hPa/hr or +0,4hPa/hr, it would be immediately known how the pressure trend behaves.

Hence, I believe that the temperature and pressure data in the json file should also contain "+", just as they do contain "-" . It is, in my opinion, both practical and logical.


PS.
mcrossley wrote: Sat 15 Oct 2022 7:55 pm So, websitedata.json does not contain <#temptrend> :?
That's right, I added a lot of tags myself to keep the data on the website up-to-date. ;)

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sun 16 Oct 2022 9:34 am
by mcrossley
Ok, sorry I missed the subtlety of the difference between rain and pressure trend. I'll look at that, I would have expected the pressure to have the leading + as well...

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sun 16 Oct 2022 3:55 pm
by mcrossley
OK, I have had a look and yes, the "trend" values sent by the various tags are inconsistent.

The numeric values are:
- presstrendval = numeric
- PressChangeLast3Hours = numeric
- TempChangeLastHour = numeric string with +
- temptrend = numeric


I do not think there is a clean way to fix this legacy, so I propose to add new tags for numeric values as strings for:
- presstrendvalstr
- PressChangeLast3HoursValStr
- temptrendvalstr

And a new numeric tag:
- TempChangeLastHourVal

Thoughts?

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Sun 16 Oct 2022 4:27 pm
by Dador
As for me, I see no problem. I can edit and add new tags to webstiedataT.json

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Wed 11 Jan 2023 9:21 pm
by Dador
I noticed that the temperature and pressure trends now have a "+" in front of the value if they are increasing. This is in the main CMX window. Have the <#temptrend> and <#presstrendval> tags been changed?

Re: <temptrend> - difference in realtime.txt and websitedata.json

Posted: Wed 11 Jan 2023 9:41 pm
by mcrossley
No