Upsample
The Upsample function is part of the HistoryFill class.
It's used to increase the resolution of low-res data by interpolating between the recorded points.
This is useful when you have unusually coarse data - such as hourly figures in a system where most of your data has 1s resolution. As such, this function is often used when bringing in information from….
- Enterprise Systems,
- Online APIs (ie. weather, stock prices etc.)
- Manual Observations,
- Informal Systems etc.
Note that if you're planning on upscaling your data, it's often a good idea to deliberately oversample your data.
For example, if you only have hourly information, it's often a good idea to request the previous and the next hours data when making a query. This way you'll be able to interpolate your analogue data to produce a smooth line rather than having a trend that contains abrupt changes.
Parameters
The function takes one parameter…
Parameter | Type | Description |
---|---|---|
Addresses | array | A 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.Upsample(pointnamelist)
See Also
You can also do the opposite job - Downsample is used to reduce the resolution of your data.