Cumulus users

Cumulus users

Hi guys,

as part of preparations for v14 I want to optimize and make the update script even better.

I am now in the process of optimizing the parsing of realtime.txt for Cumulus and we have a problem, which Im not sure how to solve – because there is no clear right or wrong answer.

So, in realtime.txt are these three parameters:

– wind speed average
– latest wind speed
– 10min wind gust

MT database includes 2 parameters – wind speed average and max wind gust for each interval.

Problem No.1:
Wind speed average
Here we have two options. Option one is to always cache the “wind speed average” parameter and then save avg of this to the db as wind speed average. This looks straight forward, but it in fact isn´t so. The db value would in such case be exactly the avg. However, the API does two things, it saves the parsed values to cache (and after 5 minutes uses this to update the db) and in addition, it saves currently parsed values into the file that includes the “current conditions”. So we have to choose now. If I take the “wind speed avg”, then the avg in the db will be spot on (it will be average of the averages in the cache), but your current value would correspond to the 1-min average, not the latest. Alternatively, I can use the latest wind parameter and in such case, the live conditions file would include the real latest value, but the average saved to db would not be average of averages, but average of the latest saved at the time of each execution of the api script.

Problem No.2:
What do we do with the gust…. cumulus does not send 5min max wind, but this is the interval in the db. So again we have two options:
First option is to cache the averages/latest values and then after 5 min save maximum of those values into the db as G. This of course creates a problem because if the gust occurs in between the interval at which you run the update CRON, it would not be registered. Theoretically you could overcome by setting the CRON update times to something very short in which case every realtime would be read by the api before being overwritten by another one.
Second option is to take the 10min max gust. This would ensure that the maximum value is registered – BUT – it would mean that this value would be duplicated in the db, because since the updates are at 5min intervals, the 10min max gust will be the same for both.

You have to tell me what you prefer…. obviously no matter what we choose it will be a compromise, but unfortunately this is the best we can do unless realtime.txt is changed or Cumulus sends data directly to the API – which is also not an option currently.

6 thoughts on “Cumulus users

  1. Hi Jachym,

    Like Neal, I think for problem No1 the most important is that db is more accurate, I use 1 minute cron job. it’s not very important for live display showing.

    problem No2, cache the latest value for gust is not a problem when you use a 1 minute cron job.

    Regards
    Charles.

  2. Hi Jachym,

    Problem No.1:
    – I prefer latest wind parameter

    Problem No.2:
    – I prefer to save the latest values and then after 5 min save maximum of those values into the db as G

    Thanks for asking.

    Cheers!

    • OK, thanks for your opinion, the only problem is that it is the exact opposite of what the only other person who reacted, wanted 😀 So in the end it will probably be down to me to choose 😀

  3. …..and this is why I will be moving (reluctantly) from my beloved raspberry pi and cumulus to meteobridge. Therefore my choice would be…

    Problem No1, I would prefer the db to be accurate , i can live with the live display showing a 1 minute average

    Problem No2, I would go for the first choice, I already have a 1 minute cron job.

    Like you say there is no win for this !

Leave a Comment