Table of Contents

Class WeatherCoverageStyle

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

How a weather layer is drawn from a WeatherCoverageSource: a colour fill (Fill), oriented symbols (Symbols) or labelled isolines (Isolines), with its S-98 display plane, its priority within the plane, its opacity and whether it is shown by default.

public abstract class WeatherCoverageStyle : ICoverageStyle
Inheritance
WeatherCoverageStyle
Implements
Derived
Inherited Members

Remarks

GRIB2 and NetCDF-CF have no portrayal catalogue, so the weather styles are SoundCharts' own, defined in code with the portrayal toolkit (WeatherPalette, Symbols, ContentScope). Being ICoverageStyles, they go through the ordinary coverage pipeline, and both renderers draw them with no weather-specific code (design note weather-sources.md §4).

StyleDrawn as
WaveHeightStyleA wave.hs fill. On by default.
WindBarbStyleWMO wind barbs from wind.speed and wind.from_direction. On by default.
WindSpeedStyleA wind.speed fill in Beaufort bands. Off by default.
WaveDirectionStyleArrows along wave.dir, sized by wave.hs. Off by default.
PressureIsobarStyleIsobars every 4 hPa on pressure.msl, labelled. On by default.
SeaTemperatureStyleA sea.temperature fill in 1 °C bands. On by default.
SeaTemperatureIsothermStyleIsotherms every 2 °C on sea.temperature, labelled. Off by default.
CurrentArrowStyleArrows along current.to_direction in S-111's speed bands. On by default; hidden inside S-111 coverage.

Layer order (design note §5): fills go on OnDemandSurface at priority FillPriority, under the S-104 surface; barbs and arrows go on DynamicArrows at priority SymbolPriority, over the S-111 arrows (priority 10); isobars go on OtherChartOverlays at priority IsolinePriority, under the observations (100). The sub-layers WeatherPortrayal builds carry these.

Land. Fills with ClipToWater set (wave height, sea surface temperature) are clipped to water when an S-101 chart is loaded, by the S-98 rule that clips the S-104 surface (S98DefaultRules.R_101_WX_B_ClipWeatherFillsToWater). Wind isn't clipped: it blows over land too.

A style holds the active palette, so give each layer its own instance. It is not meant for concurrent mutation.

Fields

FillOpacity

The opacity of the colour fills: 0.5, so the chart under them stays readable.

public const double FillOpacity = 0.5

Field Value

double

FillPriority

The fills' priority within OnDemandSurface: 0, under the S-104 surface.

public const int FillPriority = 0

Field Value

int

IsolinePriority

The isolines' priority within OtherChartOverlays: 90, under the observations (100).

public const int IsolinePriority = 90

Field Value

int

StyleVersion

The version of the weather styles, folded into ContentScope. Bump it whenever the symbols, the palette or the bands change.

public const int StyleVersion = 4

Field Value

int

SymbolPriority

The barbs' and arrows' priority within DynamicArrows: 20, over the S-111 arrows (10).

public const int SymbolPriority = 20

Field Value

int

Properties

ActivePalette

Gets the active colour palette: Palette's colours for the palette last passed to SwitchPaletteAsync(PaletteType, CancellationToken) (Day until then).

public ColorPalette ActivePalette { get; }

Property Value

ColorPalette

ActivePaletteType

The palette last passed to SwitchPaletteAsync(PaletteType, CancellationToken); Day until then.

public PaletteType ActivePaletteType { get; }

Property Value

PaletteType

ClipToWater

Whether the fill is clipped to water when an S-101 chart is loaded (ClipToWater): set for wave height, not for wind.

public bool ClipToWater { get; }

Property Value

bool

ContentScope

The weather styles' part of the tile disk-cache content scope: the style name and StyleVersion plus the toolkit version (For(string, int)).

public static string ContentScope { get; }

Property Value

string

Contours

The contours of an isoline style, resolved against the active palette (PressureIsobarStyle); empty for a fill or symbols.

public virtual IReadOnlyList<ContourStyle> Contours { get; }

Property Value

IReadOnlyList<ContourStyle>

IsVisibleByDefault

Whether the layer is drawn when nothing says otherwise: on for the wave height fill, wind barbs and isobars; off for the wind speed fill and wave arrows, which compete with the wave fill and the barbs (design note §10.1).

public bool IsVisibleByDefault { get; }

Property Value

bool

Kind

Whether the style draws a colour fill or oriented symbols.

public WeatherLayerKind Kind { get; }

Property Value

WeatherLayerKind

LayerKey

The stable sub-layer key, e.g. "weather.wave.height".

public string LayerKey { get; }

Property Value

string

Name

The layer's display name, e.g. "Wave height".

public string Name { get; }

Property Value

string

Opacity

The portrayal opacity: FillOpacity for a fill, 1 for symbols and isolines. Renderers multiply it with any user opacity.

public double Opacity { get; }

Property Value

double

Plane

The S-98 display plane: OnDemandSurface for a fill, DynamicArrows for symbols and OtherChartOverlays for isolines.

public S98DisplayPlane Plane { get; }

Property Value

S98DisplayPlane

RotationFieldName

The field the symbols are rotated by, or null for a fill.

public string? RotationFieldName { get; }

Property Value

string

Symbols

The weather symbols (wind barbs, the calm circle and the wave arrow), embedded from the project's Symbols folder. Colours are palette classes resolved against Palette.

public static SymbolSet Symbols { get; }

Property Value

SymbolSet

Remarks

The SVGs are generated by tools/GenerateWeatherSymbols and checked in. They follow the S-100 SVG conventions: sizes in millimetres (one user unit is one millimetre), the pivot point at the origin and the centre of the view box (the arrow renderers centre a symbol on its cell), and colours by palette class.

ValueFieldName

The coverage field the bands are keyed on, e.g. "wave.hs".

public string ValueFieldName { get; }

Property Value

string

WithinPlanePriority

The priority within Plane: FillPriority for a fill, SymbolPriority for symbols and IsolinePriority for isolines.

public int WithinPlanePriority { get; }

Property Value

int

Methods

AppliesTo(WeatherCoverageSource)

Whether source carries the fields this style reads (ValueFieldName and, for symbols, RotationFieldName), stored or derived.

public bool AppliesTo(WeatherCoverageSource source)

Parameters

source WeatherCoverageSource

The coverage source.

Returns

bool

CreateAll()

New instances of every weather style, in layer-stack order: the sea surface temperature, wave height and wind speed fills, the isotherms and pressure isobars, then the current arrows, wind barbs and wave arrows.

public static IReadOnlyList<WeatherCoverageStyle> CreateAll()

Returns

IReadOnlyList<WeatherCoverageStyle>

CreateFor(WeatherCoverageSource)

New instances of the styles that apply to source (AppliesTo(WeatherCoverageSource)), in the order of CreateAll().

public static IReadOnlyList<WeatherCoverageStyle> CreateFor(WeatherCoverageSource source)

Parameters

source WeatherCoverageSource

The coverage source.

Returns

IReadOnlyList<WeatherCoverageStyle>

FormatContourLabel(ContourStyle)

The label of one of Contours, e.g. "1012" for an isobar. The default is the value in the invariant culture.

public virtual string FormatContourLabel(ContourStyle contour)

Parameters

contour ContourStyle

A contour of this style.

Returns

string

IsDrawnWith(EcdisDisplaySettings?)

Whether the layer is drawn under display: its map-wide switch (LayerVisibility, keyed by LayerKey; the viewer's Display controls Weather section), or IsVisibleByDefault when the switch is unset or there are no display settings (headless rendering).

public bool IsDrawnWith(EcdisDisplaySettings? display)

Parameters

display EcdisDisplaySettings

The display settings, or null.

Returns

bool

ResolveColorScheme(MarinerSettings)

The colour bands of a fill, resolved against the active palette, or null for a symbol style.

public virtual CoverageColorScheme? ResolveColorScheme(MarinerSettings settings)

Parameters

settings MarinerSettings

Unused: the weather bands don't depend on mariner settings.

Returns

CoverageColorScheme

ResolveSymbolScheme(MarinerSettings)

The symbol bands of a symbol style, or null for a fill.

public virtual CoverageSymbolScheme? ResolveSymbolScheme(MarinerSettings settings)

Parameters

settings MarinerSettings

Unused: the weather bands don't depend on mariner settings.

Returns

CoverageSymbolScheme

SwitchPaletteAsync(PaletteType, CancellationToken)

Switches the active colour palette to type and pre-loads the assets the synchronous resolve methods need.

public ValueTask SwitchPaletteAsync(PaletteType type, CancellationToken cancellationToken = default)

Parameters

type PaletteType

The palette mood (Day, Dusk, or Night).

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

Remarks

When the style has no palette for type, implementations keep a usable palette active (the current one, or Day) rather than failing.