Hi,

If I am understanding you correctly you have a field that is being 
populated in the WeeWX database. The field data is such that you display 
cumulative values or sums (ala rain) rather than point in time values (like 
temperature, pressure etc). You have been scaling that field on your web 
page. You would now like to plot that field but you wish to plot the scaled 
data rather than the data stored in the field.

The WeeWX plot engine is fairly limited in abilities and essentially any 
observation you want to plot needs to be stored in your archive. One 
approach you could take is to use the StdCalibrate service to do your 
scaling for you and provided the field containing the scaled value is 
stored in the archive you can just plot the scaled value. For example, say 
your data is coming from the console in field new_obs, something like:

[StdCalibrate]
    [[Corrections]]
        new_obs = new_obs * 36 if new_obs is not None else None

would result in your field new_obs now containing your scaled data and 
provided new_obs is in the db schema it will be saved to archive and able 
to be plotted. An alternative if you want to keep the original data in 
new_obs would be to place the scaled data in a new field:

[StdCalibrate]
    [[Corrections]]
        another_obs = new_obs * 36 if new_obs is not None else None

This will result in your original sensor data remaining in field new_obs 
and the scaled data being in field another_obs. Provided another_obs is in 
your schema it will be saved to archive and able to be plotted. This data 
will be in seconds and I suspect there will be some scaling issues on your 
plots. You could alter the scaling formula to store your scaled data in 
decimal hours and that may plot better, something like:

[StdCalibrate]
    [[Corrections]]
        another_obs = new_obs * 36/3600 if new_obs is not None else None

Rather than re-using existing database fields it is quite straightforward 
to add new fields to the database. You can find information on adding new 
fields to the database in the section Adding a new type to the database 
<http://weewx.com/docs/customizing.htm#add_archive_type> in the 
Customization Guide.

Hope that helps and I have not misunderstood your question.

Gary

On Sunday, 26 July 2020 02:39:58 UTC+10, 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/1a7f573a-344a-4634-aefc-7d90a5e1890do%40googlegroups.com.

Reply via email to