Skip to content

ISSUE: Can't read data from grb file - #24

Draft
daniel-brandenburg wants to merge 20 commits into
nmangue:masterfrom
DHI:master
Draft

ISSUE: Can't read data from grb file#24
daniel-brandenburg wants to merge 20 commits into
nmangue:masterfrom
DHI:master

Conversation

@daniel-brandenburg

@daniel-brandenburg daniel-brandenburg commented Oct 8, 2024

Copy link
Copy Markdown

See #25 for discription

Daniel Brandenburg and others added 7 commits October 8, 2024 15:24
@mabianKT

mabianKT commented Feb 5, 2025

Copy link
Copy Markdown

@nmangue, sorry for the direct mention. I'm kindly asking when a proper release with the spatial decoding fix is planned or estimated. We are waiting for an official release that includes the fix to upgrade our applications that use the library. Thanks!

@nmangue

nmangue commented Feb 6, 2025

Copy link
Copy Markdown
Owner

v0.12.0 that was released last december should fix this issue. Do you still encounter this error ?

@mabianKT

mabianKT commented Feb 7, 2025

Copy link
Copy Markdown

v0.12.0 that was released last december should fix this issue. Do you still encounter this error ?

@nmangue The fixed version worked in our tests, but as far as I can see 0.12.0 is not yet an official release, the latest reported in the "Release" section is 0.11.0 in May 2024.
Is 0.12.0 available as a proper release somewhere?

@nmangue

nmangue commented Feb 9, 2025

Copy link
Copy Markdown
Owner

My bad, I have published the v0.12.0 on NuGet (https://www.nuget.org/packages/NGrib/0.12.0) but I did not update the Github project accordingly. This is now fixed.

@mabianKT

Copy link
Copy Markdown

@nmangue got it thank you very much. I hadn't thought of checking Nuget directly.

mdtdhi and others added 12 commits March 13, 2025 16:02
…-178-AddPeakWavePeriod-ECMWF

# Conflicts:
#	tests/NGrib.Tests/GribFileSamples.cs
…5,3)

NGrib's parameter table only carried downward long-wave radiation as the NCEP-local
variant (category 5, number 192). ECCC MSC HRDPS - and the WMO standard - encode it as
category 5, number 3 ("Surface long-wave (thermal) radiation downwards"), which was
absent, so that record resolved to no parameter and consumers dropped it. Adds the WMO
entry (mirroring the existing category-4 number-7 short-wave downwards entry).

Tests: a direct Parameter.Get(0,5,3) lookup, and reading a real HRDPS DLWRF grib sample
(Jpeg2000 accumulation) asserting the parameter resolves and the decoded field matches an
independent OpenJPEG decode (min 522543.5 = referenceValue*100, max 1724543.5 J m-2).

Bumps the package version to 0.13.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A field encoded with complex packing + spatial differencing but zero groups
(NumberOfGroups == 0, e.g. a constant all-reference-value field such as an all-zero
sea-ice-fraction field) was decoded as garbage: the group-decoding loop never writes the
secondary-value buffer, which comes from ArrayPool.Rent and holds stale data, and that
garbage then flows through the spatial-differencing reconstruction into the output.

Zero the secondary-value buffer after renting so an unwritten (zero-group) field decodes
to the reference value, matching eccodes (which returns all zeros for this field).

Also corrects two pre-existing assertions in Grib2Reader_EastChinaJapan_Test that this
exposes: the Ice test compared KeyValuePair elements against 0 (never valid) - it now
asserts every decoded value is 0; and the U10 test's expected average was wrong
(-0.0677 -> -0.6774, confirmed with eccodes; min/max already matched).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nwards

Add WMO long-wave-downwards parameter (0,5,3) + fix zero-group constant-field decode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants