Skip to content

v0.7.0

Choose a tag to compare

@cboettig cboettig released this 20 Sep 16:36
· 102 commits to main since this release
23da489

Four fixes to the raster hex path, three of which are the same class of defect: a build that succeeds, writes the expected number of partitions, passes every schema and range check, and contains the wrong data. None of them was detectable from the job's own output — each was found by measuring a finished dataset against its source.

If you hex multi-band rasters, one invocation that used to run now fails — see Behaviour changes.


⚠️ Behaviour change

Hexing a multi-band raster without --band is refused (#214)

cng-datasets raster --output-parquet passed the source to exactextract with no band index. exactextract defaults to the first band, --band was documented as "mosaic only" and was never consulted on the hex path, and the value column is named by --value-column whichever band it came from. So nothing in the run, the output schema or the parquet recorded which band was read — the output looked correct and carried a label asserting it was something it was not.

That published 384,922,346 rows of annual forb & grass cover documented as perennial cover: two variables of the same stacked product, both in 0–100, which no value-range check, row count or schema comparison can tell apart. Finding it required going back to the source raster.

A multi-band source with no band selected now stops at submission:

Input raster has 2 bands and no band was selected, so which one to hex is
ambiguous (issue #214).
  The first band would be read silently, and the output column would carry
  the --value-column name either way.
  Pass --band N (1-indexed) to choose one, or subset the band first:
    gdal_translate -b N input.tif single-band.tif

Pass --band N — which is now honoured on every path, not just the mosaic. The band is selected once, at the source, as a single-band VRT view, so nodata detection, the windowed read, the fill-code collapse, exactextract and the warp all see a raster with exactly one band and no later step can pick differently.

--band on raster-workflow is unchanged in behaviour (it still adds a preprocess-cog step that subsets the band); only its help text is corrected — it never was "multi-tile only".


--h0-index and --h0-subset take grid positions, not base cells (#213, #218)

The most expensive documentation bug in this release, because the two numberings are indistinguishable at the point of use.

--h0-index and --h0-subset were documented as "h0 base cells". They are positions in the h0 grid's own i column, which is an arbitrary permutation of the 122 H3 base cells: position 12 is base cell 9, and exactly one of the 122 positions coincides with its own base cell. Both numberings run 0–121 — so a base-cell list, which is what you get from the obvious approach of asking the H3 library which cells a raster covers, is accepted without complaint and builds an entirely different part of the world. The job then succeeds and writes the expected number of partitions.

Measured consequence, reported as #218: a western-US build derived base cells 9, 19, 20, 34, 36 by two independent methods, passed them to --h0-subset, and would have hexed open ocean and Antarctica for four of the five — roughly 80% of the dataset missing, with the job reporting success.

The mapping was also not recoverable from any published artifact. Reading s3://public-grids/hex/h0-valid.parquet in row order sorts by cell id and therefore by base cell, giving position == base cell for all 122 rows: a confident, self-consistent, wrong answer. It is the i column, not the row order.

Four changes:

  • --h0-cells is new — the same restriction given as H3 base cell numbers, converted against the grid at generation time and echoed:
    ✓ H3 base cells [9, 19, 20, 21, 34, 36] → h0 grid positions [12, 14, 20, 50, 71, 78]
    
    Available on raster and raster-workflow. Passing both --h0-cells and --h0-subset is refused rather than resolved by a precedence rule nobody would think to look up.
  • The mislabel is corrected in the CLI help, the generated manifest comment and the generator docstring.
  • Every pod logs what its position resolved to in its first lines — h0 cell: 577199624117288959 (h3 8029fffffffffff, H3 base cell 20) — so a mis-specified subset is visible at start-up rather than in the finished product's extent.
  • The range-check messages no longer confirm a wrong list. --h0-subset's errors used to describe the accepted range as "122 H3 base cells", which was the one place a caller's base-cell list felt actively validated — the check cannot tell the numberings apart, because both run 0–121 and every base-cell list is in range. The out-of-range error now names positions, states that base cell numbers share the range and are a different numbering, and points at --h0-cells; the empty-subset error gives the CONUS list in both numberings.

docs/raster_processing.md carries the measured CONUS mapping and the query that reconstructs it.


Generated merge jobs no longer die on their first statement (#217)

raster-workflow wrote the merge pod's DUCKDB_MEMORY_LIMIT as a Kubernetes quantity (16Gi). merge-chunks hands that straight to SET memory_limit, and DuckDB rejects it — Unknown unit for memory: 'gi'; it accepts only KiB/MiB/GiB/TiB or KB/MB/GB/TB.

Every chunked raster build was affected, and the failure landed after the entire hex fan-out had run — so the cost was a completed multi-hour build that could not be consolidated without hand-editing manifests.

The generator now emits DuckDB's spelling, and merge-chunks and repartition both normalise whatever reaches them, since the env var is also set by hand during recovery. Translation lives in one place (cng_datasets/duckdb_memory.py) and the regression gate is DuckDB itself rather than a string comparison — a string check would not have caught the original either, because 16Gi looks entirely reasonable.

The merge's DuckDB limit also drops to 85% of the pod's memory, matching what the repartition step has always done. memory_limit bounds DuckDB's buffer manager, not the process, so a limit equal to the cgroup's trades a parser error for an OOMKill.


Upgrading

  • Hexing a multi-band source without --band now fails at submission. Add --band N, or pre-subset with gdal_translate -b N.
  • If you pass --h0-subset or --h0-index, check which numbering your list is in. If it came from the H3 library it is base cells — switch the flag to --h0-cells and let the tool convert. For CONUS: positions 12,14,20,50,71,78 == base cells 9,19,20,21,34,36.
  • Regenerate any manifests produced by 0.6.0's raster-workflow: the merge job's DUCKDB_MEMORY_LIMIT in those is unusable as emitted.

Full changelog: v0.6.0...v0.7.0