PhilipDaubmeier.CompactTimeSeries
1.9.0
dotnet add package PhilipDaubmeier.CompactTimeSeries --version 1.9.0
NuGet\Install-Package PhilipDaubmeier.CompactTimeSeries -Version 1.9.0
<PackageReference Include="PhilipDaubmeier.CompactTimeSeries" Version="1.9.0" />
paket add PhilipDaubmeier.CompactTimeSeries --version 1.9.0
#r "nuget: PhilipDaubmeier.CompactTimeSeries, 1.9.0"
// Install PhilipDaubmeier.CompactTimeSeries as a Cake Addin #addin nuget:?package=PhilipDaubmeier.CompactTimeSeries&version=1.9.0 // Install PhilipDaubmeier.CompactTimeSeries as a Cake Tool #tool nuget:?package=PhilipDaubmeier.CompactTimeSeries&version=1.9.0
CompactTimeSeries
CompactTimeSeries is an in-memory time series library for space-efficient storing, processing, resampling and compressing of time series data.
NuGet
PM> Install-Package PhilipDaubmeier.CompactTimeSeries
When should I use it?
If you need to deal with mostly equidistant time series with a large number of values, e.g. sensor readings that are equally spaced in time, and need to process them in memory. The main classes of this library, which implement ITimeSeries<T>
allow for convenient random access read/write to a time series via time-based indexers.
If you need fast persisting/loading of such time series data, this library will not help you - just use a time series database like Influx, Graphite, CrateDB etc.
Usage
// Create a time series for today with 1 second spacing, which will result in 86400 values
var span = new TimeSeriesSpan(DateTime.Now.Date, DateTime.Now.Date.AddDays(1), TimeSeriesSpan.Spacing.Spacing1Sec);
var timeseries = new TimeSeriesStream<int>(span);
// Write to the time series via time-based indexer: the time bucket for the current second will be written
timeseries[DateTime.Now] = 42;
// Enumerate the time series values and timestamps like an IEnumerable<KeyValuePair<DateTime, T?>>
foreach (var timestampedValue in timeseries)
DoSomething(timestampedValue);
For more usage examples you can also have a look at the unit tests.
Platform Support
CompactTimeSeries is targeted for .NET 9.0 or higher.
License
The MIT License (MIT)
Copyright (c) 2019-2024 Philip Daubmeier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.9.0 - upgraded to target framework net9.0
1.8.0 - upgraded to target framework net8.0
1.7.0 - upgraded to target framework net5.0
1.6.1 - fixed multi TFM issues
1.6.0 - widened range of supported platforms by targeting netstandard2.1
1.5.0 - upgraded to target framework netcoreapp3.1
1.4.0 - migrated to netcoreapp3.0
1.3.0 - Reworked TimeSeriesResampler for correctly address sampling multiple series into a single result time bucket
1.2.0 - Added EventTimeSeriesStream for non-equidistant time series
1.1.0 - Added TimeSeriesResampler
1.0.0 - Initial version after completing unit tests and refactoring class structure