Interface ICoverageSource
Read access to a gridded (regular-grid) coverage dataset for consumption by CoveragePipeline. Product adapters (S-102 bathymetry, S-104 water level, S-111 surface currents) implement this interface over their decoded HDF5 content.
public interface ICoverageSource
Remarks
A source is stateful: SelectTime(DateTime) and SelectOverviewLevel(int) change what subsequent Metadata reads and Sample(GridRegion, CancellationToken) calls return. Implementations are not required to be thread-safe; callers that share a source must serialise the select-then-sample sequence.
Grid geometry is expressed in the grid's native CRS (HorizontalCRS), which may be a projected system such as UTM rather than WGS-84.
Properties
AvailableOverviewLevels
The overview levels this source can serve, in increasing order.
Level 0 is always the native (base) grid; higher levels are
downsampled (level N = 2^N × coarser per axis).
Sources without an overview pyramid return a single-element
list describing the base grid.
IReadOnlyList<CoverageOverviewLevel> AvailableOverviewLevels { get; }
Property Value
AvailableTimes
The time steps this coverage can be sampled at, in the order the dataset stores them. Empty for static products (S-102); populated for time-varying products (S-104, S-111).
IReadOnlyList<DateTime> AvailableTimes { get; }
Property Value
Metadata
File-level metadata: extent, grid geometry, CRS, no-data sentinel and the value fields the source carries. Available immediately after the source is constructed.
CoverageMetadata Metadata { get; }
Property Value
Remarks
Implementations may build a new instance on every read. The GridMetadata reflects the currently selected overview level (see SelectOverviewLevel(int)).
SelectedOverviewLevel
The level index currently selected by SelectOverviewLevel(int).
Defaults to 0 (base grid).
int SelectedOverviewLevel { get; }
Property Value
Methods
Sample(GridRegion, CancellationToken)
Copies the requested grid region into a SampledCoverage.
The underlying grid is already resident in memory (the HDF5 read
happens at construction time), so this is a CPU-bound copy rather than
an I/O operation; cancellationToken lets a large
copy be abandoned cooperatively. The method remains synchronous.
SampledCoverage Sample(GridRegion region, CancellationToken cancellationToken = default)
Parameters
regionGridRegionThe grid subset and stride to sample.
cancellationTokenCancellationTokenSignals that the render has been cancelled.
Returns
- SampledCoverage
The sampled values for every field in ValueFields, at the currently selected time step and overview level. The result's Metadata describes the geometry of the sampled sub-grid itself (output row/column count, origin and spacing in the native CRS), so GetPosition(int, int) locates each output cell. How cells skipped by a stride greater than one are combined (plain decimation or a reduction such as S-102's shoalest-depth minimum) is source-specific. An empty region yields a zero-cell sample.
Exceptions
- OperationCanceledException
cancellationTokenwas cancelled during the copy.
SelectOverviewLevel(int)
Selects the overview level to serve on subsequent
Metadata reads and Sample(GridRegion, CancellationToken) calls.
After the call, Metadata's
GridMetadata reflects the
level's rows/cols/spacing so viewport-derived
GridRegions pick up the correct geometry
automatically. Sources without a pyramid must accept
level == 0 as a no-op; other values may
throw or be silently clamped (see the source's documentation).
void SelectOverviewLevel(int level)
Parameters
levelintZero-based level index, expected to be in
[0, AvailableOverviewLevels.Count - 1].
SelectTime(DateTime)
Selects the time step served by subsequent Sample(GridRegion, CancellationToken) calls.
void SelectTime(DateTime time)
Parameters
timeDateTimeThe requested time. Time-varying sources select the exact match in AvailableTimes when present, otherwise the nearest available time step. Static sources treat the call as a no-op.