On Monday, July 24, 2017 at 5:52:14 PM UTC-4, Clay Jackson wrote: > > Thanks, Matt – I was more interested in how to get the “sunshine > duration”, which would be the number of seconds during the day where the > radiation was greater than 120W/m^2. I suppose I could do that as a > service and then just reset it at midnight. Then, would I need to include > that in one of the “Service” lines in the config file or is the fact that > it’s a class in “StdService” take care of that (still learning Object > Python a bit). >
when you write a custom service, you put the python code into a file in the weewx 'user' directory, then you add the python path to the service in one of the service lists in the weewx config file. see the customization guide for details about custom services: http://weewx.com/docs/customizing.htm#Adding_a_service yet another approach would be to write a search list extension. in that case, the sle would query the database for all of the radiation records since midnight, then sum the times of the periods in which the values exceed the threshold. see the customization guide for details about search list extensions: http://weewx.com/docs/customizing.htm#defining_new_tags the service approach is useful if you need the calculation for notifications or some other non-report reason. the search list extension approach is useful if you plan to use the result in one or more reports. m