average of the daily max/min temperatures for a given month

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
baobab
Junior Boarder
Junior Boarder
Posts: 37
Joined: Sat Dec 25, 2010 11:00 pm

average of the daily max/min temperatures for a given month

Post by baobab »

Hello,

Using the template function, is there a way to get the average of the daily maximum or minimum temperatures for a given month? I've looked through the template documentation but cannot find any reference to a way of doing this. Ultimately, i could pull the high of each day and use that to come up with an average but before going there, I'm hoping there is a simpler ay.

Thanks,

Baobab
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: average of the daily max/min temperatures for a given month

Post by admin »

Meteobridge provides average of all temp data of a month but not averages for daily min/max temps.
baobab
Junior Boarder
Junior Boarder
Posts: 37
Joined: Sat Dec 25, 2010 11:00 pm

Re: average of the daily max/min temperatures for a given month

Post by baobab »

OK. Thanks for the reply.

Here is one (not pretty) way of solving it using a bit of javascript in case anyone else is looking for a solution.

Baobab

Code: Select all

    <td id="jan21">
        <script>
            function january21() {
                return Math.round(([th0temp-max@20210101] + [th0temp-max@20210102] + [th0temp-max@20210103] + [th0temp-max@20210104] + [th0temp-max@20210105] +
                        [th0temp-max@20210106] + [th0temp-max@20210107] + [th0temp-max@20210108] + [th0temp-max@20210109] + [th0temp-max@20210110] +
                        [th0temp-max@20210111] + [th0temp-max@202101012] + [th0temp-max@20210113] + [th0temp-max@20210114] + [th0temp-max@20210115] +
                        [th0temp-max@20210116] + [th0temp-max@20210117] + [th0temp-max@20210119] + [th0temp-max@20210120] +[th0temp-max@20210121] +
                        [th0temp-max@20210122] + [th0temp-max@20210123] + [th0temp-max@20210124] + [th0temp-max@20210125] +[th0temp-max@20210126] +
                        [th0temp-max@20210127] + [th0temp-max@20210128] + [th0temp-max@20210129] + [th0temp-max@20210130] +[th0temp-max@20210131]) / 30 *10) /10;
            }
            document.getElementById("jan21").innerHTML = january21();
        </script>
    </td>
Post Reply