Page 1 of 1
Updating UV index in strings.ini
Posted: Wed 14 Apr 2021 4:46 pm
by canlab@sasktel.net
I currently have my website set up to display UV index. It currently shows as a number. I would like to change that to "low", "moderate", etc. Would that be done in the strings.ini file? If so how?
Re: Updating UV index in strings.ini
Posted: Thu 15 Apr 2021 11:03 am
by mcrossley
No, you would have to translate the index number into text either on your server using say PHP, or in the clients browser using a bit of JavaScript.
Re: Updating UV index in strings.ini
Posted: Thu 15 Apr 2021 2:23 pm
by ConligWX
if you take a look at Saratoga templates code you should find how it is done.
Example:
https://www.conligwx.org/wxuvforecast.php
though the url its taken from is here:
https://www.temis.nl/uvradiation/nrt/uvindex.php the value is then read and a Low, Medium, high value put in place.
Re: Updating UV index in strings.ini
Posted: Sun 22 Dec 2024 5:17 pm
by Dador
I have also been using this script for a long time. Probably the rounding of numbers used in it causes "none" to appear instead of "low" for any value below 0.5. Has anyone solved this problem for themselves?
Re: Updating UV index in strings.ini
Posted: Sun 22 Dec 2024 5:45 pm
by mcrossley
If you are using the Davis UV-I, it does not have any values below 0.5, it reports zero.
Re: Updating UV index in strings.ini
Posted: Sun 22 Dec 2024 6:49 pm
by Dador
The problem is probably in the code. The script concerns the UV index forecast and not the actual dose read.
The original script comes from saratoga-weather.
Source:
https://saratoga-weather.org/scripts-UV ... hp#UVworld