Skip to content

v1.3.0

Latest

Choose a tag to compare

@dmarkham dmarkham released this 02 Nov 03:55
146d573

v1.3.0

Fixed and tested: an upstream test audit

We compared our tests with the eccodes, libaec and openjpeg test suites. That found 80 behaviours we never tested; 21 of them were live bugs. All are fixed and covered by tests.

Round-trips

  • WriteMessage is now byte-exact on every fixture. It used to drop three things:
    • the Section 4 pv array (eccodes rejected the rewritten files)
    • Section 1 octets 22 onward
    • the reduced lat/lon point-count list
  • Multi-field messages that repeat from Section 2, 3 or 4 decode and rewrite byte-exact. New fields: Field.SharesSection3 and Field.Section2.

Decoding

  • Negative forecastTime is read as sign-magnitude.
  • A missing level scale factor means the level is used unscaled (it gave 10^127).
  • Constant fields (0 bits per value) decode to the reference value R, without the decimal scale factor, as eccodes does.
  • PNG at 25–32 bits per value no longer loses data to alpha premultiplication.
  • Legacy template numbers 5.40000 and 5.41000 are decoded.
  • Bit-map indicator 254 reuses the previous bitmap.
  • Inconsistent counts between sections are errors.

Coordinates and lookups

  • One shared grid geometry for GridCoordinates, NearestValue, BilinearValue and Sampler:
    • every scanning mode
    • every shape of the Earth, including oblate Lambert
    • basic angle and subdivisions
    • reduced Gaussian sub-areas and reduced lat/lon grids
    • rotated grids' angle of rotation
    • the 0/360 seam and Gaussian rows
  • Longitudes are in [0, 360). Inconsistent grid descriptions return errors.
  • For projected grids scanned in a mode other than 0x40, the first grid point is the first point in data order, as WMO defines it. eccodes treats it as the south-west corner; the two agree for 0x40, the common case.

Encoding

  • The reference value is never above the minimum. It used to give errors of up to 32.
  • Encoders reject NaN, infinities, values outside float32 range, and 0 bits per value on varying data. Complex packing stores NaN as missing.
  • Constant input encodes with 0 bits per value.
  • All-NaN input to complex packing stays missing, and the complex encoder no longer drops an unstored bias.
  • AEC/CCSDS: the encoder output now matches libaec byte for byte; it miscoded a run of exactly 5 zero blocks.
  • JPEG2000:
    • the decoder is ported from OpenJPEG (tiles, layers, progression orders, all code-block styles);
    • 9/7 and multi-component streams return explicit errors;
    • the encoder writes valid tile-part lengths, so Jasper reads its output;
    • encoding is limited to 30 bits per value.

Reading streams

  • Decoder skips junk and GRIB1 messages between messages; a GRIB1 message gives an error wrapping ErrNotEdition2.
  • It checks each message's total length.
  • A truncated message gives ErrTruncated; a clean end gives io.EOF.
  • No more panics on malformed templates.

New API

  • Field.SharesSection3, Field.Section2
  • Section1.Reserved, Section1.ValidateReferenceTime
  • Section6.PreviousBitmap
  • MissingScaleFactor
  • Section4.Describe(discipline)
  • Code-table names now cover every code in WMO table version 35.

Compatibility notes

  • Section1 holds a []byte, so it can no longer be compared with ==.
  • Inputs that were silently accepted now return errors. That covers invalid encoder input, inconsistent grids, mismatched counts, and a message length that doesn't match the declared total.

Tests

Every test runs from committed data, so anyone can run the full suite:

  • an eccodes-derived reference for 317 fields (exact value fingerprints, sampled coordinates, metadata, pv arrays, nearest-point answers)
  • golden encoder output that eccodes decoded
  • libaec's CCSDS test vectors
  • JPEG2000 streams checked with OpenJPEG and Jasper

With eccodes built locally:

  • GRIB2_WRITE_ECCODES_REFERENCE=1 go test -run TestEccodesReference_Write . regenerates the data.
  • TestEccodesReference_UpToDate checks the committed data still matches eccodes.