API reference

The public API consists of gribify.grib2_message, the identification and product definition classes, and the parameter classes exposed through gribify.param_set. Import parameter classes with from gribify import param_set.

See Examples for executable usage examples. The reference below is generated from the Python sources and distributed .pyi files. Constructor methods are shown explicitly so their typed arguments remain visible. Each class also provides __repr__ for its textual representation.

Code Table 0.0 string values

grib2_message(discipline=...) accepts integer codes or these strings, based on ECMWF Code Table 0.0.

Code Strings
0 "meteorological"
1 "hydrological"
2 "land surface"
3 "satellite remote sensing", "space"
4 "space weather"
10 "oceanographic"
20 "health and socioeconomic"

Strings are case-sensitive and must match exactly. The names omit products; code 3 also accepts "space", and code 20 uses "health and socioeconomic". For example, use discipline="meteorological" in place of discipline=0. Missing has no string alias; integer 255 remains accepted. Integer codes retain an unsigned 8-bit accepted range of 0 to 255 (inclusive), including reserved codes. Unknown strings raise ValueError, out-of-range integers raise OverflowError, and other types raise TypeError.

Code Table 1.2 string values

Identification(ref_time_significance=...) accepts integer codes or these strings from ECMWF Code Table 1.2, with the first letter of each Meaning changed to lowercase.

Code Strings
0 "analysis"
1 "start of forecast"
2 "verifying time of forecast"
3 "observation time"
4 "local time"
5 "simulation start"

Strings are case-sensitive and must match exactly. For example, use ref_time_significance="start of forecast" in place of ref_time_significance=1. Missing has no string alias; integer 255 remains accepted. Integer codes retain an unsigned 8-bit accepted range of 0 to 255 (inclusive), including reserved codes. Unknown strings raise ValueError, out-of-range integers raise OverflowError, and other types raise TypeError.

Code Table 1.3 string values

Identification(prod_status=...) accepts integer codes or the following strings from ECMWF Code Table 1.3. The first letter is lowercase, and the trailing products is omitted.

Code Strings
0 "operational"
1 "operational test"
2 "research"
3 "re-analysis"

Only codes 0 to 3 have string aliases. Strings are case-sensitive and must match exactly. For example, use prod_status="operational test" in place of prod_status=1. Missing has no string alias; use integer 255. Integer codes retain an unsigned 8-bit accepted range of 0 to 255 (inclusive), including codes without string aliases. Unknown strings raise ValueError, out-of-range integers raise OverflowError, and other types raise TypeError.

Code Table 1.4 string values

Identification(data_type=...) accepts integer codes or these strings, based on ECMWF Code Table 1.4. The strings use lowercase letters except for the acronym ML, omit a trailing products, and replace a trailing observations with observation.

Code Strings
0 "analysis"
1 "forecast"
2 "analysis and forecast"
3 "control forecast"
4 "perturbed forecast"
5 "control and perturbed forecast"
6 "processed satellite observation"
7 "processed radar observation"
8 "event probability"
9 "experimental data"
10 "ML based forecast"

Strings are case-sensitive and must match exactly. For example, use data_type="forecast" in place of data_type=1. Missing has no string alias; integer 255 remains accepted. Integer codes retain an unsigned 8-bit accepted range of 0 to 255 (inclusive), including reserved codes. Unknown strings raise ValueError, out-of-range integers raise OverflowError, and other types raise TypeError.

Code Table 4.3 string values

GeneratingProcess(process_type=...) and assignment to process_type accept integer codes or these strings from ECMWF Code Table 4.3, with the first letter of each Meaning changed to lowercase.

Code Strings
0 "analysis"
1 "initialization"
2 "forecast"
3 "bias corrected forecast"
4 "ensemble forecast"
5 "probability forecast"
6 "forecast error"
7 "analysis error"
8 "observation"
9 "climatological"
10 "probability-weighted forecast"
11 "bias-corrected ensemble forecast"
12 "post-processed analysis"
13 "post-processed forecast"
14 "nowcast"
15 "hindcast"
16 "physical retrieval"
17 "regression analysis"
18 "difference between two forecasts"
19 "first guess"
20 "analysis increment"
21 "initialization increment for analysis"
22 "blended forecast"

Strings are case-sensitive and must match exactly, including spaces and hyphens. For example, use process_type="forecast" in place of process_type=2. Reading process_type returns the integer code even when set using a string. Missing has no string alias; integer 255 remains accepted. Integer codes retain an unsigned 8-bit accepted range of 0 to 255 (inclusive), including reserved codes. Unknown strings raise ValueError, out-of-range integers raise OverflowError, and other types raise TypeError.

Code Table 4.4 string values

ForecastTime(unit=...) and StatisticalProcess(time_range_unit=..., time_increment_unit=...) accept integers or the strings below, based on ECMWF Code Table 4.4.

Code Strings
0 "minute"
1 "hour"
2 "day"
3 "month"
4 "year"
5 "decade", "10 years"
6 "normal", "30 years"
7 "century", "100 years"
10 "3 hours"
11 "6 hours"
12 "12 hours"
13 "second"

Strings are case-sensitive and must match exactly. For example, param_set.ForecastTime(0, 0, "minute", 30) is equivalent to param_set.ForecastTime(0, 0, 0, 30). Unknown strings raise ValueError. Missing has no string alias; use 255. Integer codes still accept 0 to 255 (inclusive), encoded as unsigned 8-bit integers, including reserved codes. Out-of-range integers raise OverflowError; other types raise TypeError.

Code Table 4.5 string values

FixedSurface(surface_type=...) accepts integer codes or the following selected strings from ECMWF Code Table 4.5. The first letter is lowercase, and trailing parenthesized units are omitted.

Code Strings
1 "ground or water surface"
10 "entire atmosphere"
100 "isobaric surface"
101 "mean sea level"
102 "specific altitude above mean sea level"
103 "specified height level above ground"
105 "hybrid level"
106 "depth below land surface"

Only these eight codes have string aliases. Strings are case-sensitive and must match exactly. For example, use surface_type="isobaric surface" in place of surface_type=100. Missing has no string alias; use integer 255. Integer codes retain an unsigned 8-bit accepted range of 0 to 255 (inclusive), including codes without string aliases. Unknown strings raise ValueError, out-of-range integers raise OverflowError, and other types raise TypeError.

Missing numeric values

Numeric arguments explicitly documented as accepting None allow it in place of an integer. Their Python type annotations use int | None. Support is opt-in per argument; accepting integers or code-table names does not by itself imply support for None.

None is converted using grib::MissingValue for the argument's underlying numeric type. For GRIB integers, the missing representation has all bits set:

Encoding Numeric missing value
Unsigned N-bit integer 2^N - 1
Signed N-bit sign-magnitude integer -(2^(N-1) - 1)

For example, the numeric missing value is -127 for signed 8-bit integers and -2147483647 for signed 32-bit integers. These numeric values remain accepted where they fall within an argument's documented range. Each argument retains its own range and validation rules; conversion does not bypass them.

Inputs other than integers or None raise TypeError, and integers outside the underlying Rust integer range raise OverflowError. For signed integers, the Rust minimum excluded by GRIB sign-magnitude raises ValueError. Specify missing values independently for each supported argument.

Currently supported arguments:

API Arguments accepting None
FixedSurface scale_factor, scaled_value
EarthShape Radius and axis scale factors and scaled values

For example, an absent surface can be constructed with param_set.FixedSurface(255, None, None). Its surface_type argument still requires integer 255 for Missing.

Missing horizontal surfaces

Horizontal.first_surface and Horizontal.second_surface constructor arguments accept FixedSurface | None. Passing None is equivalent to param_set.FixedSurface(255, None, None): the surface type, scale factor, and scaled value are all encoded as missing. Either or both surfaces can be None. For example, param_set.Horizontal(surface, None) describes a single surface.

Both arguments remain required; pass None explicitly rather than omitting an argument. Other types raise TypeError. Supplied FixedSurface objects are copied.

Message generation

gribify.grib2_message(discipline: int | str, ident: Identification, product: Union[ProductDefinition, bytes], grid: GridDefinition, values: np.ndarray[tuple[int, int], np.dtype[np.float64]], *, packing: Literal['complex', 'simple'] = 'complex', decimal_scale: int) -> bytes

Encode a GRIB2 message.

Parameters:
  • discipline (int | str) –

    Discipline - GRIB Master Table Number (see Code Table 0.0).

    Encoded as an unsigned 8-bit integer. Accepted range: 0 to 255 (inclusive). Code-table validity is the caller's responsibility. Python wrapper: also accepts the exact, case-sensitive strings listed below. Unknown strings raise ValueError; out-of-range integers raise OverflowError; other types raise TypeError. Missing has no string alias; integer 255 remains accepted.

  • ident (Identification) –

    Section 1 - Identification section.

  • product (Union[ProductDefinition, bytes]) –

    Section 4 - Product definition section.

    Python wrapper: accepts a structured definition or raw section payload bytes, excluding the five-octet section header.

  • grid (GridDefinition) –

    Regular latitude/longitude grid with an explicit Earth shape (template 3.0).

  • values (ndarray or MaskedArray) –

    Grid values indexed by latitude, then longitude. Masked entries and NaNs are encoded as missing values.

    Requires a two-dimensional float64 array with one row per grid latitude and one column per grid longitude. Masked entries are filled with NaN, regardless of fill_value, without modifying the input. Noncontiguous arrays and negative strides are supported. Dense arrays are encoded in memory order with matching grid scanning metadata; other layouts are copied in C order. Thus equivalent arrays can produce different bytes while preserving values at each coordinate.

  • packing ((complex, simple), default: "complex" ) –

    Python wrapper: selects complex packing (template 5.2, the default) or simple packing (template 5.0).

    Other strings raise ValueError.

  • decimal_scale (int) –

    A strategy specifying how many decimal places to consider valid for the numbers. This strategy is effective for various types of data, such as observation data obtained from specific observation instruments, where precision is clearly defined.

    Encoded as a signed 16-bit sign-magnitude integer. Accepted range: -32767 to 32767 (inclusive). Python wrapper: passed to encoder::SimplePackingStrategy::Decimal for both packing methods; required, with no default. For example, 2 selects two decimal places, 0 selects units, and -1 selects tens. This controls the encoder's scaling, rather than applying Python's round function to the input. Actual precision also depends on the data range and binary packing scale. Backend behavior: for constant fields encoded with simple packing and zero bits per value, the stored decimal scale is zero regardless of this argument, and the reference value stores the original constant as an IEEE 32-bit floating-point value. -32768 raises ValueError; values outside the signed 16-bit Python-to-Rust conversion range raise OverflowError. Non-integer values raise TypeError.

Notes

Python wrapper: accepted Code Table 0.0 strings (exact spelling):

Code Strings
0 "meteorological"
1 "hydrological"
2 "land surface"
3 "satellite remote sensing", "space"
4 "space weather"
10 "oceanographic"
20 "health and socioeconomic"
Returns:
  • bytes –

    The encoded GRIB2 message.

Grid definition

Construct a regular latitude/longitude grid explicitly:

earth = param_set.EarthShape(6)
grid = gribify.GridDefinition(lats, lngs, earth)
message = gribify.grib2_message(
    discipline, ident, product, grid, values, decimal_scale=1,
)

Select the Earth shape using an integer code from Code Table 3.2. For a producer-specified sphere with radius 6371000 metres, use param_set.EarthShape(1, radius_scale_factor=0, radius_scaled_value=6371000). For a producer-specified ellipsoid in metres, use code 7 with the major_axis_scale_factor, major_axis_scaled_value, minor_axis_scale_factor, and minor_axis_scaled_value arguments. Optional dimensions default to missing. The code and dimensions must be consistent with Code Table 3.2.

gribify.GridDefinition

Regular latitude/longitude grid (GRIB2 template 3.0).

__new__(lats: np.ndarray[tuple[int], np.dtype[np.float64]], lngs: np.ndarray[tuple[int], np.dtype[np.float64]], earth: param_set.EarthShape) -> GridDefinition

Create a reusable grid with an explicit Earth shape.

Parameters:
  • lats (ndarray) –

    Latitude coordinates in degrees, in data row order.

    Nonempty, finite, one-dimensional float64 array. Supply a regularly spaced axis; the grid is defined by its endpoints and point count.

  • lngs (ndarray) –

    Longitude coordinates in degrees, in data column order.

    Nonempty, finite, one-dimensional float64 array. Supply a regularly spaced axis; the grid is defined by its endpoints and point count. Use longitudes between -360 and 360, with the western end smaller than the eastern end to identify the intended grid area.

  • earth (EarthShape) –

    Shape of the Earth and optional radius/axis parameters.

    Required. Choose a shape code from Code Table 3.2.

Notes

Coordinate endpoints, counts, and Earth parameters are copied. Changes to the input arrays after construction do not affect this immutable grid. The number of grid points must fit an unsigned 32-bit integer. Coordinate regularity is the caller's responsibility. Each encoding computes scanning flags from its values array without mutating this object, so it can be reused across layouts and threads.

Raises:
  • ValueError –

    If an axis is empty, coordinates are non-finite, or the point count exceeds 4294967295.

  • TypeError –

    If array types/dimensions or the Earth shape argument are invalid.

__repr__() -> str

gribify.param_set.EarthShape

Shape of the Earth and optional scaled radius and axes (Code Table 3.2).

__new__(shape: int, *, radius_scale_factor: int | None = None, radius_scaled_value: int | None = None, major_axis_scale_factor: int | None = None, major_axis_scaled_value: int | None = None, minor_axis_scale_factor: int | None = None, minor_axis_scaled_value: int | None = None) -> EarthShape

Create Earth shape parameters for GridDefinition.

Parameters:
  • shape (int) –

    Shape of the Earth (see Code Table 3.2).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • radius_scale_factor (int or None, default: None ) –

    Scale factor of radius of spherical Earth.

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
    Missing / default None → 255
  • radius_scaled_value (int or None, default: None ) –

    Scaled value of radius of spherical Earth.

    Property Value
    Encoding Unsigned 32-bit
    Range 0 to 4294967295 (inclusive)
    Missing / default None → 4294967295
  • major_axis_scale_factor (int or None, default: None ) –

    Scale factor of major axis of oblate spheroid Earth.

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
    Missing / default None → 255
  • major_axis_scaled_value (int or None, default: None ) –

    Scaled value of major axis of oblate spheroid Earth.

    Property Value
    Encoding Unsigned 32-bit
    Range 0 to 4294967295 (inclusive)
    Missing / default None → 4294967295
  • minor_axis_scale_factor (int or None, default: None ) –

    Scale factor of minor axis of oblate spheroid Earth.

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
    Missing / default None → 255
  • minor_axis_scaled_value (int or None, default: None ) –

    Scaled value of minor axis of oblate spheroid Earth.

    Property Value
    Encoding Unsigned 32-bit
    Range 0 to 4294967295 (inclusive)
    Missing / default None → 4294967295
Notes

Values are copied. None encodes missing using grib::MissingValue. Dimensions are represented as scaled_value * 10**(-scale_factor). Choose the shape code and dimensional units consistently with Code Table 3.2: this wrapper checks integer ranges, not code-table semantics. EarthShape(6) selects shape code 6 with all optional dimensional fields missing. Code 1 permits a producer-specified spherical radius in metres; codes 3 and 7 permit axes in kilometres and metres, respectively. Numeric strings are not supported.

Raises:
  • OverflowError –

    If an integer is outside its encoding range.

  • TypeError –

    If an argument has an unsupported type.

__repr__() -> str

Identification

gribify.Identification

Section 1 - Identification section.

__new__(centre_id: int, subcentre_id: int, master_table_version: int, local_table_version: int, ref_time_significance: int | str, ref_time: datetime, prod_status: int | str, data_type: int | str) -> Identification

Create Identification.

Parameters:
  • centre_id (int) –

    Identification of originating/generating centre (see Common Code table C-11).

    Property Value
    Encoding Unsigned 16-bit
    Range 0 to 65535 (inclusive)
  • subcentre_id (int) –

    Identification of originating/generating subcentre (allocated by originating/generating centre).

    Property Value
    Encoding Unsigned 16-bit
    Range 0 to 65535 (inclusive)
  • master_table_version (int) –

    GRIB master table version number (see Common Code table C-0 and Note 1).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • local_table_version (int) –

    Version number of GRIB Local tables used to augment Master tables (see Code table 1.1 and Note 2).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • ref_time_significance (int | str) –

    Significance of reference time (see Code table 1.2).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the exact, case-sensitive strings in the Code Table 1.2 table below. Unknown strings raise ValueError; out-of-range integers raise OverflowError; other types raise TypeError.

  • ref_time (datetime) –

    Reference time of data.

    Python wrapper: supply UTC; calendar fields are copied without timezone conversion. Microseconds are not encoded.

    Property Value
    Year encoding Unsigned 16-bit; 0 to 65535 (inclusive)
    Other fields encoding Unsigned 8-bit; 0 to 255 (inclusive)
    Year range 1 to 9999 (inclusive)
    Month range 1 to 12 (inclusive)
    Day range 1 to 31 (inclusive), valid for the month and year
    Hour range 0 to 23 (inclusive)
    Minute / second range 0 to 59 (inclusive)
  • prod_status (int | str) –

    Production status of processed data in this GRIB message (see Code table 1.3).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the exact, case-sensitive strings in the Code Table 1.3 table below. Unknown strings raise ValueError; out-of-range integers raise OverflowError; other types raise TypeError.

  • data_type (int | str) –

    Type of processed data in this GRIB message (see Code table 1.4).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the exact, case-sensitive strings in the Code Table 1.4 table below. Unknown strings raise ValueError; out-of-range integers raise OverflowError; other types raise TypeError.

Notes

Python wrapper: accepted Code Table 1.2 strings (exact spelling):

Code Strings
0 "analysis"
1 "start of forecast"
2 "verifying time of forecast"
3 "observation time"
4 "local time"
5 "simulation start"

Missing has no string alias; integer 255 remains accepted.

Python wrapper: accepted Code Table 1.3 strings (exact spelling):

Code Strings
0 "operational"
1 "operational test"
2 "research"
3 "re-analysis"

Only codes 0 to 3 have string aliases. Missing has no string alias; integer 255 remains accepted.

Python wrapper: accepted Code Table 1.4 strings (exact spelling):

Code Strings
0 "analysis"
1 "forecast"
2 "analysis and forecast"
3 "control forecast"
4 "perturbed forecast"
5 "control and perturbed forecast"
6 "processed satellite observation"
7 "processed radar observation"
8 "event probability"
9 "experimental data"
10 "ML based forecast"

Missing has no string alias; integer 255 remains accepted.

Python wrapper: the optional identification template is not supported.

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

__repr__() -> str

Product definitions

gribify.ProductDefinition

Section 4 - Product definition section.

template_num: int property

Product definition template number (see Code table 4.0).

Property Value
Encoding Unsigned 16-bit
Range 0 to 65535 (inclusive)
Supported values 0, 1, 8

Python wrapper: read-only and derived from the template.

__new__(template: Union[Template4_0, Template4_1, Template4_8]) -> ProductDefinition

Create ProductDefinition.

Parameters:
  • template (Union[Template4_0, Template4_1, Template4_8]) –

    Product Definition Template (see Template 4.X, where X is the Product Definition Template Number given in octets 8-9).

Notes

Python wrapper: inputs are copied. The template number is derived automatically, and num_coord_values is always zero; trailing vertical coordinate values are not supported.

Raises:
  • TypeError –

    If template is not Template4_0, Template4_1, or Template4_8.

__repr__() -> str

gribify.Template4_0

Product definition template 4.0 - Analysis or forecast at a horizontal level or in a horizontal layer at a point in time.

__new__(param: param_set.ProductParam, generating_process: param_set.GeneratingProcess, forecast_time: param_set.ForecastTime, horizontal: param_set.Horizontal) -> Template4_0

Create Template4_0.

Parameters:
  • param (ProductParam) –

    Python argument for grib::def::grib2::template::Template4_0::param.

  • generating_process (GeneratingProcess) –

    Python argument for grib::def::grib2::template::Template4_0::generating_process.

  • forecast_time (ForecastTime) –

    Python argument for grib::def::grib2::template::Template4_0::forecast_time.

  • horizontal (Horizontal) –

    Python argument for grib::def::grib2::template::Template4_0::horizontal.

Notes

Python wrapper: inputs are copied. The upstream grouped members have no standalone prose descriptions; their Rust field paths are given above. The forecast_time field supplies these upstream contextual descriptions: cutoff_hours: "Hours of observational data cutoff after reference time (see Note 1)"; cutoff_minutes: "Minutes of observational data cutoff after reference time".

__repr__() -> str

gribify.Template4_1

Product definition template 4.1 - Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time.

__new__(param: param_set.ProductParam, generating_process: param_set.GeneratingProcess, forecast_time: param_set.ForecastTime, horizontal: param_set.Horizontal, ensemble_forecast: param_set.EnsembleForecast) -> Template4_1

Create Template4_1.

Parameters:
  • param (ProductParam) –

    Python argument for grib::def::grib2::template::Template4_1::param.

  • generating_process (GeneratingProcess) –

    Python argument for grib::def::grib2::template::Template4_1::generating_process.

  • forecast_time (ForecastTime) –

    Python argument for grib::def::grib2::template::Template4_1::forecast_time.

  • horizontal (Horizontal) –

    Python argument for grib::def::grib2::template::Template4_1::horizontal.

  • ensemble_forecast (EnsembleForecast) –

    Python argument for grib::def::grib2::template::Template4_1::emsemble_forecast.

Notes

Python wrapper: inputs are copied. The upstream grouped members have no standalone prose descriptions; their Rust field paths are given above. The generating_process field supplies this upstream contextual description for process_id: "Forecast generating process identifier (defined by originating centre)."

__repr__() -> str

gribify.Template4_8

Product definition template 4.8 - Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval.

__new__(param: param_set.ProductParam, generating_process: param_set.GeneratingProcess, forecast_time: param_set.ForecastTime, horizontal: param_set.Horizontal, statistical: param_set.Statistical) -> Template4_8

Create Template4_8.

Parameters:
  • param (ProductParam) –

    Python argument for grib::def::grib2::template::Template4_8::param.

  • generating_process (GeneratingProcess) –

    Python argument for grib::def::grib2::template::Template4_8::generating_process.

  • forecast_time (ForecastTime) –

    Python argument for grib::def::grib2::template::Template4_8::forecast_time.

  • horizontal (Horizontal) –

    Python argument for grib::def::grib2::template::Template4_8::horizontal.

  • statistical (Statistical) –

    Python argument for grib::def::grib2::template::Template4_8::time_interval.

Notes

Python wrapper: inputs are copied. The upstream grouped members have no standalone prose descriptions; their Rust field paths are given above.

__repr__() -> str

Common parameter groups

gribify.param_set.ProductParam

Python wrapper for grib::def::grib2::template::param_set::ProductParam.

category: int property writable

Parameter category (see Code Table 4.1).

Property Value
Encoding Unsigned 8-bit
Range 0 to 255 (inclusive)

num: int property writable

Parameter number (see Code Table 4.2).

Property Value
Encoding Unsigned 8-bit
Range 0 to 255 (inclusive)

__new__(category: int, num: int) -> ProductParam

Create ProductParam.

Parameters:
  • category (int) –

    Parameter category (see Code Table 4.1).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • num (int) –

    Parameter number (see Code Table 4.2).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
Notes

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

__repr__() -> str

gribify.param_set.GeneratingProcess

Python wrapper for grib::def::grib2::template::param_set::GeneratingProcess.

process_type: int property writable

Type of generating process (see Code Table 4.3).

Property Value
Encoding Unsigned 8-bit
Range 0 to 255 (inclusive)

background_process: int property writable

Background generating process identifier (defined by originating centre).

Property Value
Encoding Unsigned 8-bit
Range 0 to 255 (inclusive)

process_id: int property writable

Analysis or forecast generating processes identifier (defined by originating centre).

Property Value
Encoding Unsigned 8-bit
Range 0 to 255 (inclusive)

__new__(process_type: int | str, background_process: int, process_id: int) -> GeneratingProcess

Create GeneratingProcess.

Parameters:
  • process_type (int | str) –

    Type of generating process (see Code Table 4.3).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the exact, case-sensitive strings in the Code Table 4.3 table below. Unknown strings raise ValueError; out-of-range integers raise OverflowError; other types raise TypeError.

  • background_process (int) –

    Background generating process identifier (defined by originating centre).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • process_id (int) –

    Analysis or forecast generating processes identifier (defined by originating centre).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
Notes

Python wrapper: accepted Code Table 4.3 strings (exact spelling):

Code Strings
0 "analysis"
1 "initialization"
2 "forecast"
3 "bias corrected forecast"
4 "ensemble forecast"
5 "probability forecast"
6 "forecast error"
7 "analysis error"
8 "observation"
9 "climatological"
10 "probability-weighted forecast"
11 "bias-corrected ensemble forecast"
12 "post-processed analysis"
13 "post-processed forecast"
14 "nowcast"
15 "hindcast"
16 "physical retrieval"
17 "regression analysis"
18 "difference between two forecasts"
19 "first guess"
20 "analysis increment"
21 "initialization increment for analysis"
22 "blended forecast"

Missing has no string alias; integer 255 remains accepted. The process_type setter accepts the same strings; the getter always returns the integer code.

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

__repr__() -> str

gribify.param_set.ForecastTime

Python wrapper for grib::def::grib2::template::param_set::ForecastTime.

__new__(cutoff_hours: int, cutoff_minutes: int, unit: int | str, time: int) -> ForecastTime

Create ForecastTime.

Parameters:
  • cutoff_hours (int) –

    Hours after reference time of data cutoff (see Note 1).

    Property Value
    Encoding Unsigned 16-bit
    Range 0 to 65535 (inclusive)
  • cutoff_minutes (int) –

    Minutes after reference time of data cutoff.

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • unit (int | str) –

    Indicator of unit of time range (see Code Table 4.4).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the case-sensitive strings in the Code Table 4.4 string table below. Unknown strings raise ValueError.

  • time (int) –

    Forecast time in units defined by octet 18.

    Property Value
    Encoding Signed 32-bit, sign-magnitude
    Range -2147483647 to 2147483647 (inclusive)
Notes

Python wrapper: accepted Code Table 4.4 strings (exact spelling):

Code Strings
0 "minute"
1 "hour"
2 "day"
3 "month"
4 "year"
5 "decade", "10 years"
6 "normal", "30 years"
7 "century", "100 years"
10 "3 hours"
11 "6 hours"
12 "12 hours"
13 "second"

Missing has no string alias; use integer 255. Integer codes retain the unsigned 8-bit accepted range of 0 to 255 (inclusive). Other types raise TypeError; integers outside that range raise OverflowError.

Python wrapper: unit and time correspond to ForecastTime::time.unit and ForecastTime::time.len. The descriptions above are the field-specific dump documentation from grib. Rust i32::MIN (-2147483648) is rejected because GRIB uses sign-magnitude representation.

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

Raises:
  • ValueError –

    If unit is an unknown string or time is the Rust minimum excluded by GRIB sign-magnitude.

  • OverflowError –

    If an integer is outside the underlying Rust integer range.

__repr__() -> str

gribify.param_set.FixedSurface

Python wrapper for grib::def::grib2::template::param_set::FixedSurface.

__new__(surface_type: int | str, scale_factor: int | None, scaled_value: int | None) -> FixedSurface

Create FixedSurface.

Parameters:
  • surface_type (int | str) –

    Type of fixed surface (see Code Table 4.5).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the exact, case-sensitive strings in the Code Table 4.5 table below. Unknown strings raise ValueError; out-of-range integers raise OverflowError; other types raise TypeError.

  • scale_factor (int or None) –

    Scale factor.

    Property Value
    Encoding Signed 8-bit, sign-magnitude
    Range -127 to 127 (inclusive)
    Missing None → -127 (0xff)
  • scaled_value (int or None) –

    Scaled value.

    Property Value
    Encoding Signed 32-bit, sign-magnitude
    Range -2147483647 to 2147483647 (inclusive)
    Missing None → -2147483647 (0xffffffff)
Notes

Python wrapper: accepted Code Table 4.5 strings (exact spelling):

Code Strings
1 "ground or water surface"
10 "entire atmosphere"
100 "isobaric surface"
101 "mean sea level"
102 "specific altitude above mean sea level"
103 "specified height level above ground"
105 "hybrid level"
106 "depth below land surface"

Only the listed codes have string aliases. Trailing parenthesized units are omitted. Missing has no string alias; integer 255 remains accepted.

Python wrapper: scale_factor and scaled_value correspond to FixedSurface::value.scale_factor and FixedSurface::value.scaled_value. The represented value is scaled_value * 10**(-scale_factor). To encode an absent surface, use surface_type=255, scale_factor=None, and scaled_value=None. The numeric missing values -127 and -2147483647 remain accepted. For scale_factor and scaled_value, inputs other than integers or None (including the former "missing" string) raise TypeError. Rust i8::MIN (-128) and i32::MIN (-2147483648) are rejected.

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

Raises:
  • ValueError –

    If surface_type is an unsupported string or a signed value is the Rust minimum excluded by GRIB sign-magnitude.

  • OverflowError –

    If an integer is outside the underlying Rust integer range.

__repr__() -> str

gribify.param_set.Horizontal

Python wrapper for grib::def::grib2::template::param_set::Horizontal.

__new__(first_surface: FixedSurface | None, second_surface: FixedSurface | None) -> Horizontal

Create Horizontal.

Parameters:
  • first_surface (FixedSurface or None) –

    Python argument for grib::def::grib2::template::param_set::Horizontal::first_surface.

    None is equivalent to FixedSurface(255, None, None).

  • second_surface (FixedSurface or None) –

    Python argument for grib::def::grib2::template::param_set::Horizontal::second_surface.

    None is equivalent to FixedSurface(255, None, None).

Notes

Both arguments are required; pass None explicitly for an absent surface. Other types raise TypeError.

Python wrapper: inputs are copied. The upstream grouped members have no standalone prose descriptions; their Rust field paths are given above. The first_surface field supplies these upstream contextual descriptions: "Type of first fixed surface (see Code Table 4.5).", "Scale factor of first fixed surface.", "Scaled value of first fixed surface." The second_surface field supplies: "Type of second fixed surface (see Code Table 4.5).", "Scale factor of second fixed surface.", "Scaled value of second fixed surface."

__repr__() -> str

Ensemble and statistical parameter groups

gribify.param_set.EnsembleForecast

Python wrapper for grib::def::grib2::template::param_set::EnsembleForecast.

__new__(ensemble_forecast_type: int, perturbation_num: int, num_forecasts: int) -> EnsembleForecast

Create EnsembleForecast.

Parameters:
  • ensemble_forecast_type (int) –

    Type of ensemble forecast (see Code Table 4.6).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • perturbation_num (int) –

    Perturbation number.

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • num_forecasts (int) –

    Number of forecasts in ensemble.

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
Notes

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

__repr__() -> str

gribify.param_set.StatisticalProcess

Python wrapper for grib::def::grib2::template::param_set::StatisticalProcess.

__new__(statistical_process_type: int, time_increment_type: int, time_range_unit: int | str, time_range_length: int, time_increment_unit: int | str, time_increment_length: int) -> StatisticalProcess

Create StatisticalProcess.

Parameters:
  • statistical_process_type (int) –

    Statistical process used to calculate the processed field from the field at each time increment during the time range (see Code Table 4.10).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • time_increment_type (int) –

    Type of time increment between successive fields used in the statistical processing (see Code Table 4.11).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)
  • time_range_unit (int | str) –

    Indicator of unit of time for time range over which statistical processing is done (see Code Table 4.4).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the case-sensitive strings in the Code Table 4.4 string table below. Unknown strings raise ValueError.

  • time_range_length (int) –

    Length of the time range over which statistical processing is done, in units defined by the previous octet.

    Property Value
    Encoding Unsigned 32-bit
    Range 0 to 4294967295 (inclusive)
  • time_increment_unit (int | str) –

    Indicator of unit of time for the increment between the successive fields used (see Code Table 4.4).

    Property Value
    Encoding Unsigned 8-bit
    Range 0 to 255 (inclusive)

    Python wrapper: also accepts the case-sensitive strings in the Code Table 4.4 string table below. Unknown strings raise ValueError.

  • time_increment_length (int) –

    Time increment between successive fields, in units defined by the previous octet (see Notes 3 and 4).

    Property Value
    Encoding Unsigned 32-bit
    Range 0 to 4294967295 (inclusive)
Notes

Python wrapper: accepted Code Table 4.4 strings (exact spelling):

Code Strings
0 "minute"
1 "hour"
2 "day"
3 "month"
4 "year"
5 "decade", "10 years"
6 "normal", "30 years"
7 "century", "100 years"
10 "3 hours"
11 "6 hours"
12 "12 hours"
13 "second"

Missing has no string alias; use integer 255. Integer codes retain the unsigned 8-bit accepted range of 0 to 255 (inclusive). Other types raise TypeError; integers outside that range raise OverflowError.

Python wrapper: time_range_unit and time_range_length correspond to time_range.unit and time_range.len; time_increment_unit and time_increment_length correspond to time_increment.unit and time_increment.len. Their descriptions are the field-specific dump documentation from grib.

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

__repr__() -> str

gribify.param_set.Statistical

Python wrapper for grib::def::grib2::template::param_set::Statistical.

__new__(end_of_overall_time_interval: datetime, num_missing: int, time_ranges: List[StatisticalProcess]) -> Statistical

Create Statistical.

Parameters:
  • end_of_overall_time_interval (datetime) –

    Time of end of overall time interval.

    Python wrapper: supply UTC; calendar fields are copied without timezone conversion. Microseconds are not encoded.

    Property Value
    Year encoding Unsigned 16-bit; 0 to 65535 (inclusive)
    Other fields encoding Unsigned 8-bit; 0 to 255 (inclusive)
    Year range 1 to 9999 (inclusive)
    Month range 1 to 12 (inclusive)
    Day range 1 to 31 (inclusive), valid for the month and year
    Hour range 0 to 23 (inclusive)
    Minute / second range 0 to 59 (inclusive)
  • num_missing (int) –

    Total number of data values missing in statistical process.

    Property Value
    Encoding Unsigned 32-bit
    Range 0 to 4294967295 (inclusive)
  • time_ranges (List[StatisticalProcess]) –

    Python argument for grib::def::grib2::template::param_set::Statistical::time_ranges.

    Property Value
    Length 1 to 255 entries (inclusive)

    Python wrapper: num_time_ranges is derived from the list length.

Notes

Upstream num_time_ranges description: n - Number of time range specifications describing the time intervals used to calculate the statistically processed field.

Property Value
Encoding Unsigned 8-bit
Range 0 to 255 (inclusive)
Supported range 1 to 255 (inclusive)

Python wrapper: this field is computed from time_ranges.

Numeric ranges describe representable values accepted by the wrapper, including reserved or missing-value codes. They do not imply that every value is valid in the referenced code table. Code-table and note references are retained from the upstream GRIB2 documentation.

Raises:
  • ValueError –

    If time_ranges contains fewer than 1 or more than 255 entries.

  • OverflowError –

    If num_missing is outside the unsigned 32-bit integer range.

__repr__() -> str