Skip to content

Commit 157d1e9

Browse files
authored
Merge pull request #47 from roteiro-gis/ian/pr3
Add Gaussian and rotated grids and GRIB2 product templates 4.2–4.15
2 parents 6885c84 + ef9bb4d commit 157d1e9

18 files changed

Lines changed: 2868 additions & 202 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
expand bitmap gaps a byte at a time
2121
- locate GRIB messages with substring search instead of testing every byte
2222
offset
23+
- decode rotated latitude/longitude and regular Gaussian grids while rejecting
24+
quasi-regular geometry with a typed error
25+
- preserve GRIB2 generating-process and data-cutoff metadata and decode signed
26+
forecast offsets without unsigned wraparound
27+
- decode derived-ensemble, probability, and percentile forecasts with typed
28+
probability thresholds for product templates 4.2, 4.5, and 4.6
29+
- write product templates 4.2, 4.5, and 4.6 and compare their Section 4
30+
metadata with ecCodes in the parity suite
31+
- decode interval probability, percentile, and derived-ensemble templates 4.9,
32+
4.10, and 4.12 through one shared statistical-interval model
33+
- write interval product templates 4.9, 4.10, and 4.12 and verify their
34+
timestamps, time ranges, thresholds, and ensemble metadata against ecCodes
35+
- decode and write spatially processed product template 4.15 and verify its
36+
process type, spatial method, and source-point count against ecCodes
2337
- raise the workspace MSRV to Rust 1.87 for the coordinated breaking release
2438

2539
## 0.6.0 - 2026-06-25

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ let product = ProductDefinition {
132132
parameter_category: 0,
133133
parameter_number: 0,
134134
template: ProductDefinitionTemplate::AnalysisOrForecast(AnalysisOrForecastTemplate {
135-
generating_process: 2,
135+
type_of_generating_process: 2,
136+
background_generating_process_identifier: 0,
137+
generating_process_identifier: 0,
138+
hours_after_data_cutoff: Some(0),
139+
minutes_after_data_cutoff: Some(0),
136140
forecast_time_unit: 1,
137141
forecast_time: 6,
138-
first_surface: Some(FixedSurface {
139-
surface_type: 103,
140-
scale_factor: 0,
141-
scaled_value: 850,
142-
}),
142+
first_surface: Some(FixedSurface::with_value(103, 0, 850)),
143143
second_surface: None,
144144
}),
145145
};
@@ -163,6 +163,8 @@ GribWriter::new(&mut bytes).write_grib2_message([field])?;
163163
- Logical field indexing for multi-field GRIB2 messages
164164
- GRIB2 Section 2 access and same-message bitmap reuse through indicator 254
165165
- Regular latitude/longitude grids for GRIB1 and GRIB2
166+
- Reader GRIB2 rotated latitude/longitude template 3.1 and regular Gaussian
167+
template 3.40, with explicit typed rejection of quasi-regular grids
166168
- Reader GRIB2 Mercator grid template 3.10, polar stereographic grid template
167169
3.20, Lambert conformal grid template 3.30, and Albers equal-area grid
168170
template 3.31 metadata, projected coordinate offsets, and flat data decode
@@ -174,7 +176,10 @@ GribWriter::new(&mut bytes).write_grib2_message([field])?;
174176
- Typed metadata access for reference time, parameter identity, product metadata, grid geometry, and lat/lon coordinates
175177
- Explicit north-up decode methods in addition to reader order that preserves
176178
the encoded i/j scan directions
177-
- Reader and writer GRIB2 product definition templates 4.0, 4.1, 4.8, and 4.11
179+
- Reader GRIB2 product definition templates 4.0, 4.1, 4.2, 4.5, 4.6, 4.8,
180+
4.9, 4.10, 4.11, 4.12, and 4.15
181+
- Writer GRIB2 product definition templates 4.0, 4.1, 4.2, 4.5, 4.6, 4.8,
182+
4.9, 4.10, 4.11, 4.12, and 4.15
178183
- Forecast valid-time helpers for supported fixed-width GRIB1/GRIB2 time units
179184
- `GribFile::builder()` for strict or tolerant scanning and allocation limits
180185
- Bitmap application with missing values surfaced as `NaN`
@@ -194,11 +199,16 @@ GribWriter::new(&mut bytes).write_grib2_message([field])?;
194199

195200
## Not Yet Supported
196201

197-
- Remaining GRIB2 grid templates beyond 3.0, 3.10, 3.20, 3.30, and 3.31
198-
- Remaining GRIB2 product definition templates beyond 4.0, 4.1, 4.8, and 4.11
202+
- Remaining GRIB2 grid templates beyond 3.0, 3.1, 3.10, 3.20, 3.30, 3.31,
203+
and 3.40
204+
- Remaining reader GRIB2 product definition templates beyond 4.0, 4.1, 4.2,
205+
4.5, 4.6, 4.8, 4.9, 4.10, 4.11, 4.12, and 4.15
206+
- Remaining writer GRIB2 product definition templates beyond 4.0, 4.1, 4.2,
207+
4.5, 4.6, 4.8, 4.9, 4.10, 4.11, 4.12, and 4.15
199208
- Writer GRIB2 row-by-row complex packing
200209

201-
Unsupported cases fail explicitly with typed errors.
210+
Unsupported decode and encode operations fail explicitly with typed errors;
211+
unknown GRIB2 product templates remain indexable with their raw bytes preserved.
202212
Calendar-dependent forecast units such as months and years are exposed through
203213
raw metadata but currently return `None` from `valid_time()`.
204214

grib-core/src/error.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ pub enum Error {
2929
#[error("unsupported grid definition template: {0}")]
3030
UnsupportedGridTemplate(u16),
3131

32+
#[error("unsupported quasi-regular grid definition template: {template}")]
33+
UnsupportedQuasiRegularGrid { template: u16 },
34+
35+
#[error(
36+
"grid template {template} uses unsupported angular unit {basic_angle}/{subdivisions} degrees"
37+
)]
38+
UnsupportedGridAngularUnit {
39+
template: u16,
40+
basic_angle: u32,
41+
subdivisions: u32,
42+
},
43+
3244
#[error("unsupported data representation template: {0}")]
3345
UnsupportedDataTemplate(u16),
3446

0 commit comments

Comments
 (0)