Table of Contents

Class S111DatasetProcessor

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

Pipeline processor for S-111 surface-currents datasets. Branches between dcf2 (regular grid → coverage + arrow layers) and dcf1/dcf3/dcf8 positioned station/node series (station-arrow point layers; S-111 Edition 2.0.0 §10.2.2.6–10.2.2.9).

public sealed class S111DatasetProcessor : IDatasetProcessor, ICoveragePortrayalSource, IHeadlessImageRenderer, ITimeAwareDatasetProcessor, IDisposable, ILoadedDatasetProjection, ICoverageSampler
Inheritance
S111DatasetProcessor
Implements
Inherited Members
Extension Methods

Constructors

S111DatasetProcessor(IAssetSource, string, PortrayalCatalogueManager, ICrsTransformFactory)

Initializes a new S111DatasetProcessor by reading the HDF5 dataset relativePath from source. Used by exchange-set bulk loading.

public S111DatasetProcessor(IAssetSource source, string relativePath, PortrayalCatalogueManager catalogueManager, ICrsTransformFactory crsTransformFactory)

Parameters

source IAssetSource

The asset source (e.g. an exchange set) holding the dataset.

relativePath string

Source-relative path of the S-111 HDF5 dataset file.

catalogueManager PortrayalCatalogueManager

Supplies the S-111 portrayal catalogue.

crsTransformFactory ICrsTransformFactory

Creates the WGS84-to-native CRS transforms used when sampling a gridded dataset for GetCoverageInfo(double, double, DateTime?).

Exceptions

S100DatasetSchemaException

The file does not match the S-111 HDF5 schema. The exception carries the file name.

S100DatasetNotSupportedException

The file uses an S-111 feature this reader does not support. The exception carries the file name.

S111DatasetProcessor(string, PortrayalCatalogueManager, ICrsTransformFactory)

Initializes a new S111DatasetProcessor from the HDF5 dataset file at path. For a regular-grid (dcf2) dataset the file stays open and per-time-step values are decoded lazily; station-series datasets are read in full and the file closed.

public S111DatasetProcessor(string path, PortrayalCatalogueManager catalogueManager, ICrsTransformFactory crsTransformFactory)

Parameters

path string

Path to the S-111 HDF5 dataset file.

catalogueManager PortrayalCatalogueManager

Supplies the S-111 portrayal catalogue.

crsTransformFactory ICrsTransformFactory

Creates the WGS84-to-native CRS transforms used when sampling a gridded dataset for GetCoverageInfo(double, double, DateTime?).

Exceptions

S100DatasetSchemaException

The file does not match the S-111 HDF5 schema. The exception carries the file name.

S100DatasetNotSupportedException

The file uses an S-111 feature this reader does not support. The exception carries the file name.

Properties

AvailableTimes

Available forecast time steps in this dataset.

public IReadOnlyList<DateTime> AvailableTimes { get; }

Property Value

IReadOnlyList<DateTime>

AxisOrder

The outcome of the dataset-level axis-order check the reader ran on the dataset's positions (issue #650), or null when the product has no positions to check or the reader does not run it. A Swapped outcome means the reader swapped latitude and longitude for the whole dataset (when Normalized is set). Surfaced by hosts (CLI info, the viewer's dataset list) and, when swapped or inconsistent, as a {product}-PROJ-AXIS warning in Validate().

public AxisOrderAssessment? AxisOrder { get; }

Property Value

AxisOrderAssessment

ForecastRun

S-111 surface currents are always model forecasts, whatever their files are named, so the dataset is a run of the S-111 product. The data carries no run time of its own: a host takes it from the file name, or falls back to the later IssueTime.

public DatasetForecastRun ForecastRun { get; }

Property Value

DatasetForecastRun

IssueTime

When the producer issued the dataset (UTC), from its issueDate and issueTime (see S100IssueTime); null when the dataset does not say. For a forecast this is usually some time after the model run it carries.

public DateTime? IssueTime { get; }

Property Value

DateTime?

Metadata

The lightweight, product-agnostic DatasetMetadata for this dataset — its declared specification and, where cheaply derivable, its geographic extent, horizontal CRS, display-scale window, and temporal coverage. Overriding processors derive it once from the already-parsed dataset (never a second parse) and cache it, so hosts can frame a viewport, register a layer, draw an out-of-scale indicator, or gate visibility without re-reading the dataset. The default implementation does not override this and instead returns a fresh, minimal value carrying only Spec on each access; processors that can supply an extent (and other facts) override it with the derive-once-and-cache behaviour above. See issue #467 / #460.

public DatasetMetadata Metadata { get; }

Property Value

DatasetMetadata

Remarks

Derived from the already-parsed dataset: for gridded (dcf2) surfaces from the coverage source's georeferencing metadata; for fixed-station (dcf8) series from the union of station coordinates. No HDF5 payload is re-read (issue #467, WS1).

Spec

The product specification (name + edition) this dataset declares conformance to. Each per-spec processor returns a fixed name (e.g. "S-101"); the edition portion is populated from the dataset itself (HDF5 productSpecification attribute, GML application namespace, S-101 ProductSpecificationEdition, etc.) when known, otherwise defaults to SpecVersion default.

public SpecRef Spec { get; }

Property Value

SpecRef

VersionAssessment

How the dataset's declared product specification edition (Spec) relates to the version of the catalogue used to process it, or null when no catalogue self-describes its version (so no assessment can be made). Computed once at construction — catalogue resolution is a one-shot per processor — and surfaced by hosts (CLI info/render, viewer layer list) to warn on a version mismatch per S-100 Edition 5.2.1 Part 2 §6.

public SpecVersionAssessment? VersionAssessment { get; }

Property Value

SpecVersionAssessment

Methods

BuildCoveragePortrayalAsync(RenderContext?, CancellationToken)

Builds an immutable, Mapsui-free snapshot of this dataset's coverage portrayal for the supplied render context. Implementations run under a render gate and materialise the styled coverage (including the selected time step) so the result is safe to convert to Mapsui layers off the gate.

public Task<CoveragePortrayalResult> BuildCoveragePortrayalAsync(RenderContext? context = null, CancellationToken cancellationToken = default)

Parameters

context RenderContext

Optional render context (palette, mariner, time step).

cancellationToken CancellationToken

Cancellation token.

Returns

Task<CoveragePortrayalResult>

The Mapsui-free coverage portrayal result.

CreateLoadedData()

Allocates the LoadedDatasetData variant wrapping this processor's already-parsed model. Never re-reads the source bytes.

public LoadedDatasetData CreateLoadedData()

Returns

LoadedDatasetData

The catalog payload wrapping the resident model (e.g. an S125DatasetData or S102CoverageData).

Dispose()

Disposes the retained HDF5 file and stream, if any. For dcf2 (regular grid) datasets the file is kept open so per-time-step values can be read lazily; this releases it.

public void Dispose()

FindSites(CoverageSampleQuery)

Finds the places in this dataset that can answer a sample at the query's point: the grid node nearest to it, or every station of a station-series dataset (the nearest across datasets is chosen later).

public CoverageSiteSearch FindSites(CoverageSampleQuery query)

Parameters

query CoverageSampleQuery

The point to sample, with the transforms that reproject it into the dataset's CRS.

Returns

CoverageSiteSearch

The sites, or an empty search when the dataset does not cover the point. Implementations may throw ObjectDisposedException when the dataset was closed during the call.

Remarks

Surface current speed and direction: at the grid node nearest the point for a regular grid (dcf2), or at every station of a station series (dcf8), at the step nearest the requested time.

GetCoverageInfo(double, double, DateTime?)

Samples the surface-current grid at the supplied geographic position and time. time is matched to the nearest available time step; when null the first available step is used. The reported direction is "going to" in degrees true (S-111 Edition 2.0.0 §10.2).

public FeatureInfo? GetCoverageInfo(double latitude, double longitude, DateTime? time)

Parameters

latitude double
longitude double
time DateTime?

Returns

FeatureInfo

GetFeatureInfo(string)

Resolves dcf8 station picks routed via the Mapsui MapsuiDisplayListRenderer.FeatureRefKey tag the arrow layer attaches to each station point. Refs are formatted as "station:<id>" (see EncDotNet.S100.Datasets.Pipelines.S111DatasetProcessor.StationFeatureRefPrefix). For dcf2 gridded datasets and other refs this returns null; callers should fall back to GetCoverageInfo(double, double, DateTime?).

public FeatureInfo? GetFeatureInfo(string featureRef)

Parameters

featureRef string

Returns

FeatureInfo

RenderHeadlessAsync(int, int, RenderContext?, RgbaColor?, CancellationToken)

Renders the surface-current portrayal to a standalone SKBitmap through the headless, Mapsui-free Skia path. The selected time step is taken from TimeStep, defaulting to the first available step.

public Task<SKBitmap> RenderHeadlessAsync(int widthPixels, int heightPixels, RenderContext? context = null, RgbaColor? background = null, CancellationToken cancellationToken = default)

Parameters

widthPixels int

Output bitmap width in pixels.

heightPixels int

Output bitmap height in pixels.

context RenderContext

Optional render context (palette, time step, symbol scale).

background RgbaColor?

Optional background fill; defaults to opaque white.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<SKBitmap>

A newly allocated bitmap owned by the caller.

Validate()

Runs the V-3 S-111 validation rule pack (Default) against the gridded S111Dataset view of this processor's dataset, or returns a single-finding S111-PROJ-UNSUPPORTED report when the underlying dataset is the station-series (S111DatasetData.StationSeries) variant (dcf 3 ungeorectified grid or dcf 8 time series at fixed stations, both of which the rule pack does not cover).

public ValidationReport? Validate()

Returns

ValidationReport

Remarks

Per docs/design/non-gml-validation.md §5.1 and §5.3, this override surfaces reader-time projection diagnostics under reserved rule ids:

  • S111-PROJ-SCHEMA — defensive try/catch for S100DatasetSchemaException. The realistic failure mode is the constructor itself throwing, so this only fires if a future reader change moves schema validation later in the pipeline.
  • Station-series datasets are checked directly for sample shape, explicit timestamp ordering, and speed/direction ranges because the gridded V-3 rule pack operates on S111Dataset.

Validation is a pure function of the parsed dataset; the report is cached after the first call (mirroring the V-1 S-102 and V-2 S-104 processors).