Phil, No need to modify vantage.py, in fact modifying one of the core WeeWX files is seldom a good solution when others exist. You open yourself up to losing your changes over an upgrade or if you place your modified file in /home/weewx/bin/user (or /usr/share/weewx/user) so it is safe from upgrades, you risk missing changes to the core WeeWX files. In this case you can use StdCalibrate to create your new field. Once you create your new field, if you change you db schema to include it your new field will be automatically saved in the database. Once it is in the database you can plot it. Let's assume the name of the field that has your current sunshine data is 'sunshine_field'. As an experiment try this swapping 'sunshine_field' for the field name that presently has your sunshine data:
1. edit weewx.conf and add the highlighted lines under [StdCalibrate] [[Corrections]]: [StdCalibrate] [[Corrections]] .... sunshine_seconds = sunshine_data * 36 2. look through weewx.conf and see if you have an [Accumulator] stanza, if so add the highlighted lines, if you don't have an [Accumulator] stanza create one and add the highlighted lines: [Accumulator] [[sunshine_seconds]] extractor = sum 3. save weewx.conf. 4. stop WeeWX if it is running and run WeeWX directly <http://weewx.com/docs/usersguide.htm#Running_directly>. You should see loop packets (lines starting with LOOP:) every few seconds and archive records (lines starting with REC:) every archive interval. You should see your 'sunshine_field' and you should see the new sunshine_seconds field. Note that sunshine_seconds is not being saved to database yet as (presumably) you have not yet added a sunshine_seconds field to your db schema, once you do it will be saved to database and you can then use the field in plots. You can stop WeeWX with ctrl-C or ctrl-Z and restart the daemon. I failed to mention the [Accumulator] stanza before, the [Accumulator] stanza, among other things, is used to tell WeeWX how to create an archive record field out of the accumulated loop data for that field. In this case, just like rain, we want the sum of the data over the archive interval (most obs want the default which is average, eg temperature, pressure etc) Gary On Sunday, 26 July 2020 15:57:38 UTC+10, Phil Owers wrote: > > Hi Gary > Thanks for your quick response. > You have confirmed the best way is to populate a new field to get the > graph Im looking for. > Im happy with adding a new field to the database > This new field would have the 0.01 * 36 but im not sure how to do that > Is that done in the vantage.py file, and if so how please, or somewhere > else > Phil > > > On Saturday, July 25, 2020 at 5:39:58 PM UTC+1, Phil Owers wrote: >> >> Hi All >> >> Have been using the Instromet Stand Alone Sun Duration sensor which if >> connected to a Davis Vantage Pro2 system needs to go to a spare rain socket >> in the ISS. >> Each 0.01 is equivalent to 36 seconds of sunshine and I have converted >> that to hours and minutes on my web page. >> The next stage was to produce a graph per hour using the rain field in >> the database and to adjust that reading.either with another field in the >> database or when the plot/graph was produced . >> I did have a look in the vantage.py and came across loop_packet['rain'] >> = delta. >> So im asking is this the place to do this or am I totally in the wrong >> place to achieve a field with with rain * 36 in. >> Thanks in Advance >> > -- 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 weewx-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/b048a8b6-d8c7-49c6-b226-ef349ce2ab2eo%40googlegroups.com.