private List <ReflectedTimeSeriesPoint> LoadPointsFromNg(IAquariusClient client) { var timeSeriesInfo = client.GetTimeSeriesInfo(Context.SourceTimeSeries.Identifier); var points = client.Publish.Get(new TimeAlignedDataServiceRequest { TimeSeriesUniqueIds = new List <Guid> { timeSeriesInfo.UniqueId }, QueryFrom = Context.SourceQueryFrom?.ToDateTimeOffset(), QueryTo = Context.SourceQueryTo?.ToDateTimeOffset() }) .Points .Select(p => new ReflectedTimeSeriesPoint { Time = Instant.FromDateTimeOffset(p.Timestamp), Value = p.NumericValue1, GradeCode = p.GradeCode1.HasValue ? (int)p.GradeCode1 : (int?)null, Qualifiers = QualifiersParser.Parse(p.Qualifiers1) }) .ToList(); Log.Info($"Loaded {points.Count} points from {timeSeriesInfo.Identifier}"); return(points); }
private List <TimeSeriesPoint> LoadPointsFromNg(IAquariusClient client) { var timeSeriesInfo = client.GetTimeSeriesInfo(Context.SourceTimeSeries.Identifier); Log.Info($"Loading points from '{timeSeriesInfo.Identifier}' ..."); var timeSeriesData = client.Publish.Get(new TimeSeriesDataCorrectedServiceRequest { TimeSeriesUniqueId = timeSeriesInfo.UniqueId, QueryFrom = Context.SourceQueryFrom?.ToDateTimeOffset(), QueryTo = Context.SourceQueryTo?.ToDateTimeOffset() }); var gradesLookup = new MetadataLookup <PublishGrade>(timeSeriesData.Grades); var qualifiersLookup = new MetadataLookup <PublishQualifier>(timeSeriesData.Qualifiers); if (!Context.IgnoreNotes) { Notes.AddRange(LoadAllNotes(client, timeSeriesInfo, timeSeriesData.Notes)); } var points = timeSeriesData .Points .Select(p => new TimeSeriesPoint { Time = Instant.FromDateTimeOffset(p.Timestamp.DateTimeOffset), Value = p.Value.Numeric, GradeCode = gradesLookup.GetFirstMetadata(p.Timestamp.DateTimeOffset, g => int.Parse(g.GradeCode)), Qualifiers = qualifiersLookup.GetManyMetadata(p.Timestamp.DateTimeOffset, q => q.Identifier).ToList() }) .ToList(); var gapToleranceInMinutes = timeSeriesData.GapTolerances.Last().ToleranceInMinutes; var gapTolerance = gapToleranceInMinutes.HasValue ? Duration.FromMinutes((long)gapToleranceInMinutes.Value) : DurationExtensions.MaxGapDuration; var interpolationType = (InterpolationType)Enum.Parse(typeof(InterpolationType), timeSeriesData.InterpolationTypes.Last().Type, true); SetTimeSeriesCreationProperties( timeSeriesInfo, timeSeriesData.Methods.LastOrDefault()?.MethodCode, gapTolerance, interpolationType); Log.Info($"Loaded {PointSummarizer.Summarize(points)} and {"note".ToQuantity(Notes.Count)} from {timeSeriesInfo.Identifier}"); return(points); }
private List <ReflectedTimeSeriesPoint> LoadPointsFromNg(IAquariusClient client) { var timeSeriesInfo = client.GetTimeSeriesInfo(Context.SourceTimeSeries.Identifier); Log.Info($"Loading points from '{timeSeriesInfo.Identifier}' ..."); var timeSeriesData = client.Publish.Get(new TimeSeriesDataCorrectedServiceRequest { TimeSeriesUniqueId = timeSeriesInfo.UniqueId, QueryFrom = Context.SourceQueryFrom?.ToDateTimeOffset(), QueryTo = Context.SourceQueryTo?.ToDateTimeOffset() }); var points = timeSeriesData .Points .Select(p => new ReflectedTimeSeriesPoint { Time = Instant.FromDateTimeOffset(p.Timestamp.DateTimeOffset), Value = p.Value.Numeric, GradeCode = GetFirstMetadata(timeSeriesData.Grades, p.Timestamp.DateTimeOffset, g => int.Parse(g.GradeCode)), Qualifiers = GetManyMetadata(timeSeriesData.Qualifiers, p.Timestamp.DateTimeOffset, q => q.Identifier).ToList() }) .ToList(); var gapToleranceInMinutes = timeSeriesData.GapTolerances.Last().ToleranceInMinutes; var gapTolerance = gapToleranceInMinutes.HasValue ? Duration.FromMinutes((long)gapToleranceInMinutes.Value) : DurationExtensions.MaxGapDuration; var interpolationType = (InterpolationType)Enum.Parse(typeof(InterpolationType), timeSeriesData.InterpolationTypes.Last().Type, true); SetTimeSeriesCreationProperties( timeSeriesInfo, timeSeriesData.Methods.LastOrDefault()?.MethodCode, gapTolerance, interpolationType); Log.Info($"Loaded {points.Count} points from {timeSeriesInfo.Identifier}"); return(points); }