I have a question about how to log the sunshine hours. I thought to log "1" for every minute the radiation is above 75% expected maximum radiation and 0 when it is below. When I do a daily sum of this parameter, I'd get a number of sunshine minutes for a day.
I chose to log these "sunny minutes" in the "hailRate" parameter. In the database, it is logged OK (1 or 0). However, when I display the value in the html, it gives completely different value. I suspect it does some internal pre-calculation. This is how I want to show the daily sunshine minutes: $day.hailRate.sum.raw How to get a real sum (not recalculated) from the hailRate? Shall I use another non-used parameter in the default weewx.sdb for this? I'd like to avoid adding a new custom field and database recompilation. Thank you! I admit I don't follow the discussion frequently. I was thinking about the > sunshine hours log - from the posts I understand the interval is considered > "sunny" if the solar radiation is above a fixed threshold (e.g. 120 W/m2). > I have second thoughts. For one of my stations I use Weather Display and > there the logic is different. An interval is sunny if the solar radiation > is 75% or above expected maximum solar radiation for the given > latitude/longitude and time of day & year. > I haven't done this to other stations where I use weewx yet but I plan to > write a simple (bash) script that would compare the current/max solar > radiation every minute and log 0 or 1 to the database. I can then simply > make a sum and get sunshine minutes per day. Does this make any sense? > I have a script that does a similar calculation already but has more > threshold values (in %) that tell me sky conditions. And it works very > well. I guess I could write a python script and integrate it with weewx but > don't have enough knowledge. > Cheers. > > Dne petek, 01. november 2019 11.59.54 UTC+1 je oseba Stefan napisala: >> >> Hello Andrew. >> >> Yes.Thats it. Thank you very Much. It works! >> >> Thanks >> Stefan >> >> Am Mittwoch, 16. Oktober 2019 15:08:35 UTC+2 schrieb Andrew Milner: >>> >>> check your file - it looks as though there is now a 'stray' letter v in >>> the file as a result of your editing!! A typo of somekind clearly!! >>> >>> >>> >>> On Wednesday, 16 October 2019 14:57:33 UTC+3, Stefan wrote: >>>> >>>> Thx Gary. >>>> I made the change. However, it does not work either. There is still >>>> the error message: >>>> >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: engine: Caught unrecoverable >>>> exception in engine: >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** name 'v' is not >>>> defined >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** Traceback (most >>>> recent call last): >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** File >>>> "/usr/share/weewx/weewx/engine.py", line 884, in main >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** engine = >>>> engine_class(config_dict) >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** File >>>> "/usr/share/weewx/weewx/engine.py", line 78, in __init__ >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** >>>> self.loadServices(config_dict) >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** File >>>> "/usr/share/weewx/weewx/engine.py", line 142, in loadServices >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** >>>> self.service_obj.append(weeutil.weeutil._get_object(svc)(self, >>>> config_dict)) >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** File >>>> "/usr/share/weewx/weeutil/weeutil.py", line 1130, in _get_object >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** mod = >>>> __import__(module) >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** File >>>> "/usr/share/weewx/user/radiationhours.py", line 174, in <module> >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** v >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** NameError: name 'v' >>>> is not defined >>>> Oct 16 13:54:28 raspberrypi weewx[12153]: **** Exiting. >>>> >>>> >>>> Am Mittwoch, 16. Oktober 2019 09:27:48 UTC+2 schrieb gjr80: >>>>> >>>>> OK, essentially the same file but double spaced. The problem looks >>>>> like it is due to field radiation being either missing or None. Try >>>>> changing the following line: >>>>> >>>>> syslog.syslog(syslog.LOG_DEBUG, "Calculated sunshine_hours = %f, >>>>> based on radiation = %f, and min_sunshine = %f" % >>>>> >>>>> to >>>>> >>>>> syslog.syslog(syslog.LOG_DEBUG, "Calculated sunshine_hours = %f, >>>>> based on radiation = %s, and min_sunshine = %f" % >>>>> >>>>> You will need to restart WeeWX for the change to take effect. >>>>> >>>>> Gary >>>>> >>>>> On Wednesday, 16 October 2019 16:50:00 UTC+10, Stefan wrote: >>>>>> >>>>>> Hello Gray. >>>>>> >>>>>> Here is the Script. Thx for Help. >>>>>> >>>>>> Am Mittwoch, 16. Oktober 2019 07:47:43 UTC+2 schrieb gjr80: >>>>>>> >>>>>>> Chances are field radiation does not exist in an archive record or >>>>>>> it is set to None. I am afraid if you want any further help you are >>>>>>> going >>>>>>> to have to post the copy of radiationhours.py that you are using; >>>>>>> the version in the repo you linked only has 106 lines of code and the >>>>>>> error >>>>>>> trace you posted indicates the error is at line 203. >>>>>>> >>>>>>> Gary >>>>>>> >>>>>>> On Wednesday, 16 October 2019 15:26:42 UTC+10, Stefan wrote: >>>>>>>> >>>>>>>> Hello. >>>>>>>> >>>>>>>> The problem has reappeared today. Weewx stops the work. I have not >>>>>>>> changed the script, not adjusted to the threshold. This is still >>>>>>>> on 120W min. It ran until this morning without problems. But again >>>>>>>> this error message. >>>>>>>> >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: engine: Caught >>>>>>>> unrecoverable exception in engine: >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** float argument >>>>>>>> required, not NoneType >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** Traceback (most >>>>>>>> recent call last): >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/weewx/engine.py", line 890, in main >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** engine.run() >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/weewx/engine.py", line 160, in run >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** >>>>>>>> self.dispatchEvent(weewx.Event(weewx.STARTUP)) >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/weewx/engine.py", line 224, in dispatchEvent >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** >>>>>>>> callback(event) >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/weewx/engine.py", line 520, in startup >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** >>>>>>>> self._catchup(self.engine.console.genStartupRecords) >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/weewx/engine.py", line 635, in _catchup >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** >>>>>>>> origin='hardware')) >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/weewx/engine.py", line 224, in dispatchEvent >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** >>>>>>>> callback(event) >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** File >>>>>>>> "/usr/share/weewx/user/radiationhours.py", line 203, in >>>>>>>> newArchiveRecord >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** >>>>>>>> (event.record['sunshine_hours'], radiation, self.min_sunshine)) >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** TypeError: >>>>>>>> float argument required, not NoneType >>>>>>>> Oct 16 07:22:48 raspberrypi weewx[14709]: **** Exiting. >>>>>>>> >>>>>>>> >>>>>>>> Am Samstag, 12. Oktober 2019 11:46:57 UTC+2 schrieb gjr80: >>>>>>>>> >>>>>>>>> If you must modify the code then yes that will do what you want >>>>>>>>> provided there is no min_sunshine setting in weewx.conf. >>>>>>>>> >>>>>>>>> Gary >>>>>>>>> >>>>>>>> -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/d025f4f2-0d37-4e4d-b14c-9dc8e9dae618%40googlegroups.com.
