Skip to content

v0.4.0

Choose a tag to compare

@cboettig cboettig released this 09 Sep 14:32
· 115 commits to main since this release
06836c9

Seventeen changes since v0.3.1. The theme, if there is one: this release makes the tool louder. Most of what is fixed here produced plausible output with exit code 0 — a truncated source, a raster tagged with the wrong CRS, a numeric column published as text, a hex build missing features — and each was found by a real catalog build rather than by a test. Several fixes therefore turn silence into a failure or a warning, which is the point, but it means builds that "worked" before may now stop.

Read the Behaviour changes section before upgrading a running pipeline.


⚠️ Behaviour changes

Breaking

Armada backend defaults to non-preemptible (#183). Converted jobs now use armada-default instead of armada-preemptible, and a k8s opportunistic priority class no longer maps onto armada-preemptible. An opportunistic k8s pod is preempted but recreated by its Job controller; a preempted Armada job is not rescheduled at all, and Job-level retry settings do not survive conversion — so the old default turned multi-hour work into preemptible work with no retry and no rescheduling. Pass --armada-priority-class preemptible to opt back in, which is the right default once units are small enough that losing one is cheap.

May fail a build that previously passed

Hex completeness check (#170). repartition_by_h0 now hard-fails when distinct hexed features are fewer than source features with non-null geometry. The hex Job covers only max-completions × chunk-size features, so a larger source was silently truncated while every presence-based downstream check still passed. If a build starts failing here, it was already losing data. Escape hatch for known-degenerate geometries: CNG_SKIP_COMPLETENESS_CHECK=1.

Truncated conversions (#186). --expect-features N fails the conversion when the written count differs. Opt-in, but every conversion now logs Wrote N rows unconditionally — previously a run that converted a third of its input produced a log byte-identical to a complete run.

Antimeridian polygons (#167). A polygon whose ring crosses ±180° now errors immediately instead of hanging for hours. A hang becomes a clear, actionable failure.

Changes output values or locations

A source CRS with no authority code is now actually reprojected (#187). detect_crs returned None for such a CRS and None reads as "no reprojection needed", so geometries were written unchanged while the GeoParquet presented them as lon/lat — a MODIS sinusoidal source published as projected metres tagged EPSG:4326, exit code 0. Every MODIS-derived product ships such a CRS. Datasets built from one before this release are wrong and should be reprocessed.

CSV columns are typed from the whole file (#188). A column entirely NULL within DuckDB's default 20480-row head sample was typed VARCHAR even when cleanly numeric throughout — fatality and evacuation counts published as strings. This changes the output schema for affected CSV sources: a consumer that added a cast to work around it will need that cast removed. --csv-sample-size restores a bounded sample for a file too large to scan.

Hierarchical --dataset no longer flattens in raster S3 paths (#189). --dataset a/b published hex to s3://<bucket>/a-b/hex/ instead of s3://<bucket>/a/b/hex/, so a raster ingest landed outside its own prefix and the STAC hex and COG hrefs pointed into different trees. Raster output locations change for hierarchical dataset names. Flat names are unaffected.

Null-geometry chunks write an empty partition (#169) instead of aborting the whole indexed Job with "No files found". Expect empty partition files where a build previously died.

Changes generated manifests on regeneration

Raster hex worker count is now pinned (#195). Generated hex jobs emit CNG_HEX_WORKERS and CNG_HEX_CHUNK_SIZE explicitly, defaulting to one worker per requested CPU. Previously neither was emitted and the pod sized its own pool from the cgroup CPU quota — which reads as unlimited whenever the container's /sys/fs/cgroup is the host root rather than its own namespace, so the count silently became the node's core count. One manifest ran 48 workers on one node and 64 on another, on a pod requesting 4 CPUs, and peak memory followed: 145–185 GiB against a 192 GiB limit, versus 115–144 GiB for the hand-written equivalent that set the variable. Expect slower but bounded hex pods at the default; pass --hex-workers to trade back.

Hex completions are right-sized (#144). Chunk size is floored at 1000 instead of driven down to spread work across max_completions. A 5,697-feature dataset went from 197 pods to 6. Large builds still cap at max_completions with unchanged per-pod cost. Regenerating a small or medium workflow emits a very different completion count.

Step manifests carry metadata.namespace (#190). Only workflow.yaml, configmap.yaml and workflow-rbac.yaml had it, so applying a step manifest directly — which the docs sanction — targeted whatever namespace kubectl defaulted to. Jobs now land in the declared namespace.

Armada default queue biodiversity → geo-workflows (#183). Affects direct callers of convert_workflow_to_armada; the workflow generators already pass the namespace explicitly.


New: raster scales down, not just out

The headline work is #173 — a hex pod's memory used to track the densest h0 base cell's H3-cell count, not the raster's own size: ~282M cells and ~140 GiB measured at res 10. That forced an oversized flat memory request which then chronically failed to schedule, because NRP's 256Gi nodes have only ~250Gi allocatable.

Three changes, each measured:

Boundary derivation moved into workers. The parent fetched (cell_id, boundary_wkt) for every child of an h0 before starting work; the WKT was ~96% of that list — 183 bytes per cell against 8 for the id — and ~85% of the parent's peak RSS. A boundary is a pure function of its id, so each worker now derives its own. Peak RSS for the enumeration falls 18.3 → 4.6 GiB at res 9 and 4.0 → 0.68 GiB at res 8; a res-10 h0 goes from ~128 GiB to ~32 GiB. Output is byte-identical, verified over a full h0 for mean, mode and fractions.

--chunk-resolution N / --chunk-index K, plus cng-datasets merge-chunks. The unit of work becomes an h0's res-N descendant rather than the whole h0, cutting the largest chunk's cell count ~7× per level — h1 4.6 GiB, h2 0.68 GiB, against ~32 GiB for a whole h0. H3 nests exactly, so descendants tile their parent with no seams to dedup and no gaps, unlike bbox tiling where a native cell straddling an edge would be split or double-counted. merge-chunks consolidates each h0 back to the single published h0={cell}/data_0.parquet, so the layout does not depend on how finely the build was chunked. Default is unchanged at --chunk-resolution 0.

--window-reads {auto,always,never}. A chunk reads only its own window of the source COG instead of localizing the whole file. Full localization is a fixed cost per pod, so total transfer scaled with the fan-out rather than the data — fine across 122 h0 pods, ruinous across the thousands sub-h0 chunking creates (a 2 GB COG at h2 would move ~12 TB). Measured on a 4 MiB tiled fixture:

chunk chunks windowed whole-file copies saving
h0 1 4.00 MiB 4.00 MiB 1.0×
h1 7 12.00 MiB 28.00 MiB 2.3×
h2 49 14.50 MiB 196.02 MiB 13.5×
h3 343 20.01 MiB 1372.17 MiB 68.6×

The shape matters more than any row: the windowed total grows slowly with depth while whole-file copies grow linearly with the chunk count.

Building sub-h0 chunking surfaced a latent trap worth knowing about even if you never use these flags: H3's hierarchy is only approximately containing — a descendant cell can protrude beyond its ancestor's boundary polygon. Pruning a chunk against its own boundary therefore dropped native cells that genuinely overlapped the raster, silently. Measured across the globe, the protrusion converges rather than compounding (0.127 of the chunk's extent at one level down, 0.150 by three, unchanged at four), so a depth-independent margin is sound; the constant carries a ~1.7× safety factor and both facts are pinned by tests.


Other new capability

Raster hex memory levers (#195): --hex-workers, --hex-chunk-size and --hex-cpu on raster-workflow. Peak RSS is roughly workers × chunk size × bytes per cell. --hex-memory is not an equivalent lever — a request large enough to matter makes the pod contend for scarce large-RAM nodes and converts a retryable OOM into an unschedulable pod. The generator now prints the resulting pod profile so an oversubscribed pod is visible before it is applied.

--h0-subset on raster-workflow (#191): the h0 base cells the source overlaps, e.g. "12,14,20,50,71,78" for CONUS. A regional raster previously started 116 pods (95%) that each localized a multi-GB COG, found no overlap and exited — the most common reason a catalog recipe stopped being generator output.

CSV lat/lon point input (#78): .csv/.tsv sources are now first-class, with columns auto-detected from common names, so a standard CSV needs no flags. --lat-column/--lon-column also reach the workflow subcommand (#188), which previously made a CSV point source unusable as a generated pipeline's --source-url at all.

--simplify-tolerance (#132): ST_SimplifyPreserveTopology after reprojection, in target-CRS units. Right-sizes high-vertex sources that overflowed the PMTiles ephemeral cap.

--trim-strings (#180): strips stray whitespace from string columns. WDPA stores its fully-no-take category as 'All ' in the source GDB, so every consumer's WHERE NO_TAKE = 'All' silently returned zero rows. Off by default.

cng-datasets pmtiles-columns (#140): reads tile-accurate table:columns from a PMTiles footer via byte range, never fetching the tile body. tippecanoe writes only a subset of source columns into the tiles, so the PMTiles schema differs from the source Parquet.

--armada-priority-class (#183) on workflow and raster-workflow — the Armada priority class was previously unreachable from the CLI.


Other fixes

  • --method warp-centroid declares its GDAL requirement instead of crashing partway through a build with a bare TypeError from inside the warp, after the pod had already localized the COG (#173). Detected by feature rather than version number, before any raster is opened. It deliberately does not fall back to exact-extract: that is a different aggregation, not a slower one.
  • A non-geometry column named GEOMETRY/SHAPE/GEOM no longer shadows the real geometry column (#171). Geometry now resolves by DuckDB type first.
  • Non-joinable H3 builds warn, naming the consequence — the output cannot be joined against the rest of the catalog on h8, the universal join key (#182). Two previously-silent cases: a target coarser than h8, or finer than h8 with h8 absent from --parent-resolutions (whose raster default is 0 alone).
  • Dropped Armada retry settings are reported rather than silently discarded, naming what is lost (#183).

Full changelog: https://github.com/boettiger-lab/datasets/blob/v0.4.0/CHANGELOG.md
Compare: v0.3.1...v0.4.0