Esempio n. 1
0
        public static Timeseries GetMonthlyAverages(string registerId)
        {
            var storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("StorageConnectionString"));

            var repo = new RegistryEntryRepo(storageAccount);
            var sortedTvqs = repo.GetRegistryEntries().OrderBy(x => x.Time);

            var tsWithRegisterEntries = new Timeseries();
            tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

            var periodizer = new Periodizer();
            var monthlyRegisterEntries = periodizer.MonthlyAverage(tsWithRegisterEntries);

            var deltaOperator = new DeltaTsOperator();
            var monthlyAverages = deltaOperator.Apply(monthlyRegisterEntries);

            return monthlyAverages;
        }
Esempio n. 2
0
        public static Timeseries GetMonthlyAverages()
        {
            var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo();
            var sortedTvqs = repo.GetRegistryEntries(Thread.CurrentPrincipal).OrderBy(x => x.Time);

            var tsWithRegisterEntries = new Timeseries();
            tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

            var periodizer = new Periodizer();
            var monthlyRegisterEntries = periodizer.MonthlyAverage(tsWithRegisterEntries);

            const int minMonths = 2;
            var tooFewEntries = monthlyRegisterEntries.Count < minMonths;
            var areTooFewEntries = tooFewEntries;
            if (areTooFewEntries)
            {
                throw new TooFewEntriesException(minMonths);
            }

            var deltaOperator = new DeltaTsOperator();
            var monthlyAverages = deltaOperator.Apply(monthlyRegisterEntries);

            return monthlyAverages;
        }