Fixing meter data
Data from smart meters and inverters is rarely complete. Values are missing, timestamps drop out or a register jumps back. What do you repair, and what do you only flag?
What can go wrong
- Missing values. The timestamp is there, the reading is not.
- Missing timestamps. The whole row is absent from the series.
- Decreasing readings. A meter reading should only go up. A decrease points to a meter replacement, a reset, a register that rolled over, or a bad measurement.
- Dips and spikes. One or more readings that are too low or too high, after which the series carries on as normal.
What you can repair
A gap between two known readings can be repaired with interpolation. With meter readings the total is fixed: the difference between the reading before and after the gap. You only spread it over the intervals in between. A gap at the start or end of a series is harder, because only one side is known.
What you should flag
With a decreasing reading you often only see what happened from the readings after it. So do not change such a value silently. Flag it with a code and a reason, and let a rule or a person decide. Do not repair around it either, because that reading is no longer a reliable anchor.
Do it yourself or use an API
For one dataset, pandas or SQL is enough. See how to interpolate time series data. If you process meter data in several systems, each system ends up with slightly different exceptions. eclipse does it in one place: an API that repairs gaps, flags suspicious readings and never changes a measured value.
Keep reading: Interpolating meter data: linear between readings
More about eclipse: Fix and interpolate meter data through an API.