Class WeatherGridSet
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
originWeatherOriginThe model or centre and the run time.
nativeGridWeatherNativeGridThe grid as the file stores it; it's normalised here.
parametersIReadOnlyList<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
Layout
How the file's grid maps onto Grid.
public WeatherGridLayout Layout { get; }
Property Value
Origin
The model or centre and the run time.
public WeatherOrigin Origin { get; }
Property Value
Parameters
The parameters on the grid, known and unknown, in the order the reader found them.
public IReadOnlyList<WeatherParameter> Parameters { get; }
Property Value
Methods
FindParameter(string, WeatherLevel?)
Finds a parameter by id, at level or at any level.
public WeatherParameter? FindParameter(string id, WeatherLevel? level = null)
Parameters
idstringThe parameter id, for example WindU.
levelWeatherLevelThe 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
parameterWeatherParameterA parameter of this set.
stepIndexintIndex into Steps.
cancellationTokenCancellationTokenSignals that the caller no longer needs the step.
Returns
Exceptions
- ArgumentOutOfRangeException
stepIndexis out of range.