Hi group,
Running weewx 4, Python 3, Mysql-database, Vantage Pro 2 with solar, UV.
Within Weewx, I want to calculate a derived value from two existing values that's provided by my weather station. To be more specific, in the Netherlands, the shortage of precipitation is calculated by the amount of rainfall minus the amount of evapotransipration (sum of max ET-values every day). During the period of april till september, it;'s a drought indicator.
My SQL-query to do show is, where 'tekort' (Dutch) stands for 'shortage'.
select abs(round(sum(archive_day_rain.sum)-sum(archive_day_ET.sum),0)) as tekort from archive_day_ET,archive_day_rain where from_unixtime(archive_day_rain.datetime,'%Y')=year(curdate()) and month(from_unixtime(archive_day_rain.datetime)) >= 4 and month(from_unixtime(archive_day_rain.datetime)) <= 9 and archive_day_rain.datetime=archive_day_ET.datetime;
What I am doing right now, is running a crontab job, and start my PHP-script every minute to calculate the outcome of the SQL-script above and writes the outcome to a plan txt-file. Next step is to grab this value from the txt-file and show it (javascript) on my website. See
http://www.weerinwelsum.nl, below the webcam. It says ' Doorlopend neerslagtekort', [amount of millimeters]. This is the value I am talking about.
What I really want to achieve, is that I calculate this derived valu by WeeWX itself, and make this derived value available for everything that's wants to use is. For example, store this derived value in a database-field I am not using (for example, soilTemp4) and make this derived value available for whatever skin (in my case, Belchertown). In other words, Weewx calculates this new value and makes it available for the complete WeeWX-ecosystem (if you understand what I mean).
Am I clear in what I want to achieve? And is this possible, and what are the pointers to do so?