Downsample

The Downsample function is part of the HistoryFill class.

It's used to decrease the amount of data transmitted to the ARDI server by summarising and/or aggregating data points.

This allows users to query large time-periods of data without overwhelming the network or server.

Generally, this should done in the data source wherever possible (ie. using an SQL statement with 'GROUP BY', choosing an aggregation method in your query etc.).

However, informal systems rarely have easy ways to perform this sort of task - the Downsample function is used in these situations.

Parameters

The function takes one parameter…

ParameterTypeDescription
AddressesarrayA list of strings, containing the addresses for each point to be resampled

Warning

This function is only for use on analogue data points. Do not use this function on discrete (ie. on/off) data.

Example

#Record all of the points, building a list of the names as we go...
pointnamelist = []
for p in allpoints:
   if p.name not in pointnamelist:
      pointnamelist.append(p.name)
   history.RecordAnalogue(p.name,p.time,p.value)
 
#Upscale the low-resolution data
history.Downsample(pointnamelist)

See Also

You can also do the opposite job - Upsample is used to increase the resolution of your data.

Autosample is used to automatically choose if up or down-sampling is appropriate.