Repository navigation
v5.2.0
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_fractionandanswered_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 incolumn_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 cellson itsfeature_api_errorsrow. 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 afeature_api_success = Nrow, 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_pctbut lost some cells was labelledNeven though its features were in the rollup. It is nowY, and its failed cells stay infeature_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.
- Before: a Roof Age outage for a whole chunk, or a Feature API outage masked by Roof Age roofs, became a permanent
-
Nullable dtypes survive the rollup concat (#235, #237): integer columns such as
building_countno longer read back fromrollup.parquetasfloat64when 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 toobject, 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 parsedYYYY-MM-DDvalues as datetimes.- Without a
survey_resource_idcolumn: the exporter rejected the file ("must contain YYYY-MM-DD strings"). - With one: the dates were silently ignored as per-AOI cutoffs.
read_from_filenow returns datetimesince/untilcolumns asYYYY-MM-DDstrings, with nulls left null. This applies to all exporters, and also covers timestamp-typed Parquet columns. It does not coverdate32Parquet columns, which pandas reads as Python dates; write those as strings. - Without a
-
Damage Conflation CLI on Python 3.14 (#236):
python -m nmaipy.damage_conflation_exporterfailed before parsing any arguments. The--parcel-modehelp contained a bare%, and Python 3.14's argparse validates help strings when options are added. On earlier versions, only--helpcrashed. -
Coverage point queries page through every survey (#236):
/coverage/v2/pointreturns surveys newest-first, one page at a time.discover_event,latest_event_id_at_pointandget_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
offsetuntiltotal, through the same loopevent_boundaryalready used. -
The
--aoi-grid-cell-sizehelp 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-existentpoolspack (the API rejects it asUNKNOWN_PACK); it now usespool.
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_successnow means "has a response" (#235): partially gridded AOIs withinaoi_grid_min_pctchange fromNtoY.- "Nothing exported" check: the export exits 1 when no rollup row has
feature_api_successorroof_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_griddedreturns a 4-tuple (#235), with the grid summary added. It now raisesAIFeatureAPIGridErrorwhere 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 mostlimit. Callers that usedlimitas 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_errorsunder the AOI'saoi_id, even when the AOI itself is a success. To count failed AOIs, usefeature_api_successoranswered_area_fractionrather than distinctaoi_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), sopytest -m "not live_api"runs fully offline. - Includes a formatting-only commit for black 26 and isort.