title: Resample, aggregate, and interpolate of TimeSeries trend data
body: <p>In analysis of energy demand and consumption data, I'm having issue re-sampling and interpolating time series trended data.</p>
  
  <p>Data set example:</p>
  
  <pre><code>timestamp                value kWh
  ------------------       ---------
  12/19/2011 5:43:21 PM    79178
  12/19/2011 5:58:21 PM    79179.88
  12/19/2011 6:13:21 PM    79182.13
  12/19/2011 6:28:21 PM    79183.88
  12/19/2011 6:43:21 PM    79185.63
  </code></pre>
  
  <p>Based upon these observations, I'd like some aggregation to roll-up values based upon a period of time, with that frequency set to a unit of time.</p>
  
  <p>As in, intervals on the hour filling any gaps of missing data</p>
  
  <pre><code>timestamp                value (approx)
  ------------------       ---------
  12/19/2011 5:00:00 PM    79173
  12/19/2011 6:00:00 PM    79179
  12/19/2011 7:00:00 PM    79186
  </code></pre>
  
  <p>For a linear algorithm, it seems I would take the difference in time and multiply the value against that factor.</p>
  
  <pre><code>TimeSpan ts = current - previous;
  
  Double factor = ts.TotalMinutes / period;
  </code></pre>
  
  <p>Value and timestamp could be calculated based upon the factor.</p>
  
  <p>With such quantity of available information, I'm unsure why it's difficult to find the most elegant approach to this.</p>
  
  <p>Perhaps first, are there open source analysis libraries that could be recommended?</p>
  
  <p>Any recommendations for a programmatic approach?  Ideally C#, or possibly with SQL?</p>
  
  <p>Or, any similar questions (with answers) I could be pointed to?</p>