Class GribField
One field of a GRIB2 file, as indexed when the file opens: the parameter, level, times, grid and packing of one data section, and where it is in the file. The values are decoded only when ReadValues(GribField, CancellationToken) is called.
public sealed class GribField
- Inheritance
-
GribField
- Inherited Members
Remarks
A message usually holds one field. A message that repeats sections 2 to 7 (or 3 to 7, or 4 to 7) holds one field per Section 7; each field takes the most recent Section 1 to 6 before it. NOAA and ECMWF files hold one field per message.
A field with an unsupported grid, product or data template is still listed, with UnsupportedReason naming the template, so a caller can show what the file holds; reading its values throws.
Properties
DataRepresentation
The data representation: how the values are packed.
public GribDataRepresentation DataRepresentation { get; }
Property Value
Discipline
The discipline (Section 0, code table 0.0), for example 0 meteorological or 10 oceanographic.
public byte Discipline { get; }
Property Value
FieldNumber
The zero-based number of the field within its message (non-zero only for repeated sections).
public int FieldNumber { get; }
Property Value
Grid
The grid definition.
public GribGrid Grid { get; }
Property Value
HasBitmap
Whether a bitmap (Section 6) marks some grid points as missing.
public bool HasBitmap { get; }
Property Value
Identification
The identification section: centre, tables and reference time.
public GribIdentification Identification { get; }
Property Value
Index
The field's position in Fields.
public int Index { get; }
Property Value
IsSupported
Whether the field's values can be decoded (UnsupportedReason is null).
public bool IsSupported { get; }
Property Value
MessageIndex
The zero-based number of the message that holds the field.
public int MessageIndex { get; }
Property Value
MessageLength
The length of the message in bytes, from Section 0.
public long MessageLength { get; }
Property Value
MessageOffset
The byte offset of the message ("GRIB") in the file.
public long MessageOffset { get; }
Property Value
Parameter
The parameter as (discipline, category, number).
public GribParameterCode Parameter { get; }
Property Value
Product
The product definition: parameter, level and times.
public GribProduct Product { get; }
Property Value
ReferenceTime
The reference time (Section 1), in UTC: for a forecast, the model run time.
public DateTime ReferenceTime { get; }
Property Value
UnsupportedReason
Why the field's values can't be decoded, naming the unsupported template; or null when they can.
public string? UnsupportedReason { get; }
Property Value
ValidTime
The time the values are valid for, in UTC: the reference time plus the forecast time, or for a statistic over a time interval (template 4.8) the end of the interval. null when the product template isn't supported.
public DateTime? ValidTime { get; }
Property Value
Methods
FindWeatherParameter()
Finds the canonical weather parameter (design note weather-sources.md ยง3.5) this field holds: its parameter code through FindByGribCode(GribParameterCode), and its level matching the row's level where the row has one (10 m for the wind rows, mean sea level for pressure).
public WeatherParameterDefinition? FindWeatherParameter()
Returns
- WeatherParameterDefinition
The row, or null for a parameter or level the table doesn't have.
ToString()
Returns a one-line inventory entry, for example
"#3 0,2,2 type 103 = 10 ref 2026-10-25T00:00Z valid 2026-10-25T03:00Z 3.0 4.0 5.3".
public override string ToString()
Returns
ToWeatherLevel()
The field's level as a WeatherLevel: the surface (fixed surface type 1), mean sea level (101), a height above ground (103), or Other(string) describing anything else, such as a layer or NCEP's "1 in sequence" swell partitions (type 241).
public WeatherLevel ToWeatherLevel()
Returns
ToWeatherNativeGrid()
The grid as the weather model's WeatherNativeGrid, with increments signed by the scanning mode.
public WeatherNativeGrid ToWeatherNativeGrid()
Returns
Exceptions
- UnsupportedWeatherGridException
The grid isn't a regular latitude/longitude grid (template 3.0); the message names the template.