Skip to content

v1.2.0

Choose a tag to compare

@dmarkham dmarkham released this 12 Oct 20:37
· 1 commit to master since this release
fab24c0

v1.2.0

New: Sampler for reusable bilinear weights

BilinearValue unpacks the whole field on every call (~408 µs per point on an RDPS rotated grid), which rules it out for rendering, regridding, or reading the same points from many fields on one grid.

  • NewSampler(f) builds once per grid; Weights(lat, lon) returns the four corner indices and fractions, and Interpolate applies them to the Values() of any field on that grid.
  • Supports templates 3.0, 3.1 and regular 3.40.
  • BilinearWeights.Outside flags points beyond the grid edge (clamped to the edge cell, as before).
  • NearestCorner() returns the heaviest corner for categorical fields such as precipitation type.
  • Sampler.Matches(f) checks that a field shares the grid.
  • BilinearValue is now built on the same weights/interpolate steps with the same arithmetic order, so its results are unchanged.

Verification

Sampler results are bit-identical to BilinearValue, errors included, across 69 decodable fixture grids (57 on 3.0, 4 on 3.1, 8 on 3.40). The existing suite passes unchanged.

lookup cost per point
BilinearValue 408 µs
Sampler.Weights + Interpolate 0.21 µs