I would recommend against changing the sign of the readings. And I would try this (not tested):
#set $data = $year.gridProduction.series(aggregate_type='min', aggregate_interval=86400, time_series='start', time_unit='unix_epoch_ms').round(0).json #set $data = [ [i,-j] for i,j in $data ] michael.k...@gmx.at schrieb am Donnerstag, 14. November 2024 um 06:45:22 UTC+1: > > The problem is - imho - that the observation type is not recorded > correctly in the first place. Purchased energy is different from produced > energy is different from supplied energy is different from directly > consumed energy, etc., so supplied energy to the grid isn't just the same > as purchased energy from the grid, just with a negative sign. To display > the values in a comprehensive way, the straightforward way would be to > record the data in that way. So supplied energy (gridProduction as you call > it) should be a positive value, when recorded. My power meter at the > metering point gives positive values for this observation type. > > https://weewx.com/docs/5.1/reference/weewx-options/stdcalibrate/ > > [StdCalibrate] [[Corrections]] gridProduction = -gridProduction > > Keep in mind you have to migrate existing data in the database and > recalculate daily summaries for this obs_type, if you do it that way. > Steeple Ian schrieb am Mittwoch, 13. November 2024 um 22:52:04 UTC+1: > >> I am using the following in a .tmpl file to generate series data for a >> Highcharts chart: - >> >> $year.gridProduction.series(aggregate_type='min', >> aggregate_interval=86400, time_series='start', >> time_unit='unix_epoch_ms').round(0).json >> >> This series produces either 0 or negative numbers, something like this >> extract: - >> >> [[1731024000000, 0], [1731110400000, -107], [1731196800000, -407], >> [1731283200000, -341]] >> >> Is there any straightforward way of converting the negative values to >> absolute numbers? >> >> The context is solar generated power. When the grid values are negative, >> solar generated power is being exported to the grid. >> >> Thank you >> > -- 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 visit https://groups.google.com/d/msgid/weewx-user/c6bcb3b4-232e-4f31-bb57-3985f45219f5n%40googlegroups.com.