Class S102CoverageSource
Adapts an S-102 S102Dataset to the pipeline-facing ICoverageSource. Supports the coverage overview pyramid (issue #486): when a level > 0 is selected via SelectOverviewLevel(int) the pyramid is built lazily on first access with MinReducer for depth (shoal-biased) and MaxReducer for uncertainty (worst-case). Residual viewport stride applies equivalent reductions over balanced blocks that preserve the sampled footprint's regular georeferencing.
public class S102CoverageSource : ICoverageSource
- Inheritance
-
S102CoverageSource
- Implements
- Inherited Members
Constructors
S102CoverageSource(S102Dataset, int)
Creates a coverage source over one bathymetry coverage of an S-102 dataset. The overview pyramid is not built until a level other than the base level is requested.
public S102CoverageSource(S102Dataset dataset, int coverageIndex = 0)
Parameters
datasetS102DatasetThe parsed S-102 dataset.
coverageIndexintIndex into Coverages of the coverage to expose. Defaults to the first coverage.
Fields
FillValue
S-102 standard fill value for no-data cells.
public const float FillValue = 1000000
Field Value
MaxPyramidLevels
Maximum number of pyramid levels (base + downsampled). Cap = 6 gives 64× reduction per axis; a 2048×2048 tile shrinks to 32×32. Approved in issue #486 review.
public const int MaxPyramidLevels = 6
Field Value
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.
public 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).
public IReadOnlyList<DateTime> AvailableTimes { get; }
Property Value
Remarks
S-102 has no time dimension, so this list is always empty.
Coverage
The single bathymetry coverage instance this source exposes.
public BathymetryCoverage Coverage { get; }
Property Value
Dataset
The underlying S-102 dataset wrapped by this source.
public S102Dataset Dataset { 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.
public 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).
public int SelectedOverviewLevel { get; }
Property Value
Spec
The dataset's declared product specification, resolved from DeclaredProductSpecification; the edition is default (unknown) when the file declares none.
public SpecRef Spec { 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.
public virtual 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.
Remarks
Samples the currently selected overview level. When the region's stride skips cells, depth is reduced to the shoalest value (minimum) and uncertainty to the worst case (maximum) within each block.
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).
public 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.
public 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.
Remarks
Does nothing: S-102 has no time dimension.