Table of Contents

Class WeatherGridSet

Namespace
EncDotNet.S100.Datasets.Weather
Assembly
EncDotNet.S100.Datasets.Weather.dll

The in-memory model every weather reader produces (design note weather-sources.md §3.4): where the data comes from, one regular latitude/longitude grid, and the parameters on it, each with its time steps. Everything after the reader (normalisation, drawing, sampling and picking) works on this model.

public sealed class WeatherGridSet
Inheritance
WeatherGridSet
Inherited Members

Remarks

Weather model data isn't official S-100 or ENC data and isn't for navigation; hosts label it so wherever it appears (§3.1).

Constructors

WeatherGridSet(WeatherOrigin, WeatherNativeGrid, IReadOnlyList<WeatherParameter>)

Creates a grid set.

public WeatherGridSet(WeatherOrigin origin, WeatherNativeGrid nativeGrid, IReadOnlyList<WeatherParameter> parameters)

Parameters

origin WeatherOrigin

The model or centre and the run time.

nativeGrid WeatherNativeGrid

The grid as the file stores it; it's normalised here.

parameters IReadOnlyList<WeatherParameter>

The parameters on the grid.

Exceptions

UnsupportedWeatherGridException

The grid can't be normalised, for example because it crosses the antimeridian (see WeatherGridLayout).

ArgumentException

Two parameters share an id and level.

Properties

Grid

The normalised grid: south-west origin, rows running north, longitudes in −180 to 180.

public WeatherGrid Grid { get; }

Property Value

WeatherGrid

Layout

How the file's grid maps onto Grid.

public WeatherGridLayout Layout { get; }

Property Value

WeatherGridLayout

Origin

The model or centre and the run time.

public WeatherOrigin Origin { get; }

Property Value

WeatherOrigin

Parameters

The parameters on the grid, known and unknown, in the order the reader found them.

public IReadOnlyList<WeatherParameter> Parameters { get; }

Property Value

IReadOnlyList<WeatherParameter>

Methods

FindParameter(string, WeatherLevel?)

Finds a parameter by id, at level or at any level.

public WeatherParameter? FindParameter(string id, WeatherLevel? level = null)

Parameters

id string

The parameter id, for example WindU.

level WeatherLevel

The level, or null for the first parameter with the id at any level.

Returns

WeatherParameter

The parameter, or null when the set has none.

ReadStep(WeatherParameter, int, CancellationToken)

Decodes one step of a parameter and normalises it to Grid's order, with missing values as NaN. Nothing is cached; WeatherCoverageSource keeps recent steps.

public float[] ReadStep(WeatherParameter parameter, int stepIndex, CancellationToken cancellationToken = default)

Parameters

parameter WeatherParameter

A parameter of this set.

stepIndex int

Index into Steps.

cancellationToken CancellationToken

Signals that the caller no longer needs the step.

Returns

float[]

A new array of length CellCount.

Exceptions

ArgumentOutOfRangeException

stepIndex is out of range.