Table of Contents

Class CoverageSampling

Namespace
EncDotNet.S100.Datasets.Pipelines.Query
Assembly
EncDotNet.S100.Core.dll

Samples one or more ICoverageSamplers at a point: chooses the dataset and site that answer, applies the time handling, and reads it. Shared by the sample_coverage tools and by CoverageSamplerExtensions, so every product treats time the same way.

public static class CoverageSampling
Inheritance
CoverageSampling
Inherited Members

Remarks

Site selection: grid nodes win over stations. Among stations only the nearest (and others within a metre of it, such as one station reported by two runs) are considered. "Nearest cell" is the cell whose centre is closest to the point; no interpolation is performed.

Time handling: of the candidate sites, those whose time range contains the requested time are preferred, and the best-ranked of them wins (finest grid or nearest station, then newest run). A request within one time-step interval of either end of a range counts as in range. The nearest time step is read; ties go to the earlier step. A single instant outside every candidate's range is CoverageSampleOutcome<TSource>.TimeOutOfRange unless the caller opts into the nearest step, in which case the result's TimeStatus says which end was used. A windowed query prefers a candidate spanning the whole window, then the one covering most of it; it returns the covered part, flagged truncated, and is out of range only when there is no overlap at all (issue #789).

Methods

SampleAlong<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>>, IEnumerable<(double Latitude, double Longitude)>, ICrsTransformFactory, DateTimeOffset?, bool)

Samples at each vertex of a polyline, at the same time, in vertex order.

public static IReadOnlyList<CoverageSampleOutcome<TSource>> SampleAlong<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>> samplers, IEnumerable<(double Latitude, double Longitude)> vertices, ICrsTransformFactory transforms, DateTimeOffset? time = null, bool nearestWhenOutOfRange = false)

Parameters

samplers IReadOnlyList<CoverageSamplerEntry<TSource>>

The datasets to choose from, in the host's order.

vertices IEnumerable<(double Latitude, double Longitude)>

The polyline's vertices (decimal degrees, WGS-84).

transforms ICrsTransformFactory

Reprojects each vertex into a dataset's native CRS.

time DateTimeOffset?

The requested time, applied to every vertex; null for the first step.

nearestWhenOutOfRange bool

See SampleAt<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>>, CoverageSampleQuery, DateTimeOffset?, bool).

Returns

IReadOnlyList<CoverageSampleOutcome<TSource>>

Type Parameters

TSource

The host's handle for a dataset.

SampleAt<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>>, CoverageSampleQuery, DateTimeOffset?, bool)

Samples at a single instant (or the first step when time is null).

public static CoverageSampleOutcome<TSource> SampleAt<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>> samplers, CoverageSampleQuery query, DateTimeOffset? time, bool nearestWhenOutOfRange = false)

Parameters

samplers IReadOnlyList<CoverageSamplerEntry<TSource>>

The datasets to choose from, in the host's order (which breaks ties).

query CoverageSampleQuery

The point.

time DateTimeOffset?

The requested time, or null for the first step.

nearestWhenOutOfRange bool

When the time is outside every candidate's range: false returns CoverageSampleOutcome<TSource>.TimeOutOfRange; true reads the nearest step and reports it in the time status.

Returns

CoverageSampleOutcome<TSource>

Type Parameters

TSource

The host's handle for a dataset.

SampleWindow<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>>, CoverageSampleQuery, CoverageTimeWindow)

Samples over a range or series window. Only sites with Steps answer; when none does, the first WindowUnsupportedReason is reported.

public static CoverageSampleOutcome<TSource> SampleWindow<TSource>(IReadOnlyList<CoverageSamplerEntry<TSource>> samplers, CoverageSampleQuery query, CoverageTimeWindow window)

Parameters

samplers IReadOnlyList<CoverageSamplerEntry<TSource>>

The datasets to choose from, in the host's order.

query CoverageSampleQuery

The point.

window CoverageTimeWindow

The window.

Returns

CoverageSampleOutcome<TSource>

Type Parameters

TSource

The host's handle for a dataset.

SelectTimeStep(IReadOnlyList<DateTime>, DateTimeOffset?)

The index of the step closest to requested; 0 when it is null. Times outside the range clamp to the first or last step (per S-100 Part 10c ยง10.2.1.1, time-step indices are in [0, numberOfTimes - 1]); callers decide beforehand whether an out-of-range request may be sampled at all. Ties go to the earlier index.

public static int SelectTimeStep(IReadOnlyList<DateTime> steps, DateTimeOffset? requested)

Parameters

steps IReadOnlyList<DateTime>

The time steps in storage order (ascending or descending); at least one.

requested DateTimeOffset?

The requested time.

Returns

int