Skip to content

v5.2.0

Choose a tag to compare

@mbewley mbewley released this 27 Oct 09:20
· 204 commits to main since this release
e934fec

What's New

The rollup now has one row for every input AOI and reports how much of each AOI was actually observed. Chunk completion is judged separately for each API. The Damage Conflation CLI works on Python 3.14, and coverage point queries no longer stop at one page.

Features

  • Answered-coverage columns in the rollup (#235): grid_cells, grid_cells_answered, answered_area_fraction and answered_area_{sqm|sqft}.

    • Gridded AOI: the cells it was split into, the cells that answered, the answered share of its area, and that share in the country's unit.
    • AOI answered in one request: null / null / 1.0 / its own area.
    • AOI not answered: null throughout.

    answered_area_{unit} is the denominator for share-of-AOI figures such as percent cover, so failed cells don't count as observed. These columns describe the AOI, so they're kept out of the features and per-class files; each one is documented in column_metadata.json.

  • Failed grids report their coverage (#235): a grid that fails as a whole now carries its cell counts and a message such as 38 of 80 grid cells answered (49.5% of area), failed cells by status {404: 42}; needed 100% of cells on its feature_api_errors row. The status is 404 only when every failed cell was a 404; otherwise it is the most common other status. Previously it was whichever cell happened to tip the threshold.

  • README: disaster-response workflows (#236): three runnable examples:

    • per-survey damage classifications;
    • AI layers on post-catastrophe surveys, including which packs read post-cat surveys;
    • a point → event → building-damage Damage Conflation script.

    Pack and include names in the README are corrected (pool, damage / damage_non_postcat, the post-cat packs, windHailRiskScore).

Bug Fixes

  • All-404 chunks get one rollup row per AOI (#235): a chunk where every AOI returned 404 (no survey coverage) wrote a zero-row rollup marker in 5.1.8, so those AOIs were missing from rollup. Each AOI now gets a feature_api_success = N row, with your input columns carried through, produced by the same code path as 404 AOIs in a mixed chunk.

  • A gridded AOI that answered counts as a Feature API success (#235): an AOI that met aoi_grid_min_pct but lost some cells was labelled N even though its features were in the rollup. It is now Y, and its failed cells stay in feature_api_errors.

  • Chunk completion is judged per enabled API (#235):

    • Before: a Roof Age outage for a whole chunk, or a Feature API outage masked by Roof Age roofs, became a permanent N.
    • Now: such chunks are re-fetched on resume, with answers that did come back served from the cache, and the merge won't complete until they settle.
    • Treated as final: 404s for both APIs, and 403s for Roof Age.
  • Nullable dtypes survive the rollup concat (#235, #237): integer columns such as building_count no longer read back from rollup.parquet as float64 when an all-404 chunk is present. Before concatenating, each chunk's all-null columns are cast to the type the column has in chunks with values. This keeps the merge from widening every chunk's numeric columns to object, which took several times the memory on large rollups.

  • GeoJSON and GeoPackage AOI files can carry per-row since / until (#237): these formats have no column types, so the reader parsed YYYY-MM-DD values as datetimes.

    • Without a survey_resource_id column: the exporter rejected the file ("must contain YYYY-MM-DD strings").
    • With one: the dates were silently ignored as per-AOI cutoffs.

    read_from_file now returns datetime since / until columns as YYYY-MM-DD strings, with nulls left null. This applies to all exporters, and also covers timestamp-typed Parquet columns. It does not cover date32 Parquet columns, which pandas reads as Python dates; write those as strings.

  • Damage Conflation CLI on Python 3.14 (#236): python -m nmaipy.damage_conflation_exporter failed before parsing any arguments. The --parcel-mode help contained a bare %, and Python 3.14's argparse validates help strings when options are added. On earlier versions, only --help crashed.

  • Coverage point queries page through every survey (#236): /coverage/v2/point returns surveys newest-first, one page at a time. discover_event, latest_event_id_at_point and get_surveys_from_point (standard coverage) read only the first page. At a heavily flown point:

    • older post-catastrophe events were missed, and left out of the multi-event warning;
    • point coverage histories, including those from get_coverage_from_points, stopped at 100 surveys.

    All three now follow offset until total, through the same loop event_boundary already used.

  • The --aoi-grid-cell-size help gave ~200 m for the 0.005° default. The figure is now computed from the default (~555 m).

  • examples.py: the pool-detection example requested the non-existent pools pack (the API rejects it as UNKNOWN_PACK); it now uses pool.

Breaking Changes

  • The rollup merge requires one row per input AOI (#235): the final merge exits 1 unless the rollup chunks hold exactly one row per input AOI. An export started on 5.1.8 or earlier and resumed on 5.2.0 still completes (#237): its zero-row coverage-gap rollups no longer count as done, so the resume re-fetches those chunks (re-querying their AOIs). No manual clean-up is needed.
  • feature_api_success now means "has a response" (#235): partially gridded AOIs within aoi_grid_min_pct change from N to Y.
  • "Nothing exported" check: the export exits 1 when no rollup row has feature_api_success or roof_age_api_success = Y. This replaces 5.1.8's "every rollup is empty" check, which can no longer happen. A request misconfigured so that it 404s everywhere still exits 1.
  • Chunks where an API was down for the whole chunk are no longer marked complete (#235): they are re-fetched on resume. Until they succeed, the merge exits 1. This includes Roof Age: an export where the Roof Age client raises on every chunk, or where every AOI in a chunk gets a Roof Age 4xx other than 403/404, now exits 1 after the Feature API pass instead of completing with roof_age_api_success = N.
  • FeatureApi.get_features_gdf_gridded returns a 4-tuple (#235), with the grid summary added. It now raises AIFeatureAPIGridError where it previously returned empty metadata.
  • get_surveys_from_point(limit=...) is now the page size (#236): it returns every survey at the point instead of at most limit. Callers that used limit as a cap will get more rows.
  • New rollup columns (#235): consumers that select columns by name are unaffected; consumers that rely on column position will see the new columns.

Notes

  • A gridded AOI's failed cells stay in feature_api_errors under the AOI's aoi_id, even when the AOI itself is a success. To count failed AOIs, use feature_api_success or answered_area_fraction rather than distinct aoi_ids in the error file.
  • With prefer3d, a gridded AOI whose 3D pass failed mostly with 404s plus one other status is now reported with that other status. So it is not retried in 2D.
  • Coverage chunk caches (coverage_chunk_*.parquet) written by earlier versions are reused as they are, and stay truncated at 100 surveys per point. Delete them to re-query.
  • All tests that call the real API are now marked live_api (#235), so pytest -m "not live_api" runs fully offline.
  • Includes a formatting-only commit for black 26 and isort.