Skip to content

GeoJSON 3D-position fix + pyncoda user unit-counts and lean runs - #143

Merged
fmckenna merged 2 commits into
NHERI-SimCenter:masterfrom
zsarnoczay:master
May 23, 2026
Merged

GeoJSON 3D-position fix + pyncoda user unit-counts and lean runs#143
fmckenna merged 2 commits into
NHERI-SimCenter:masterfrom
zsarnoczay:master

Conversation

@zsarnoczay

Copy link
Copy Markdown
Contributor

This PR bundles two independent changes

fix(geo_tools): strip Z from GeoJSON positions

GeoJSON (RFC 7946) permits positions with 3+ elements (e.g.
[lon, lat, altitude]), but InputValidator.validate_coordinates and the
downstream geometry pipeline assume strict 2-element pairs. With a 3D GeoJSON,
every Asset fails validation in Asset.__init__, silently falls back to an
empty coordinate list, and floods the log with "Coordinates input is not a
list" warnings — losing all geometry.

parse_geojson_geometry now slices each position to [:2] across the Point,
LineString, MultiLineString, Polygon, and MultiPolygon branches, dropping
altitude/extra dimensions before they reach the 2D-only validator. The combined
LineString/MultiLineString branch is split since their nesting depths differ.

Follow-up worth considering: making the geometry pipeline natively 3D-aware so
imported GeoJSON can round-trip without dropping altitude.

feat(pyncoda): user-supplied unit counts + lean BRAILS runs

  • User-provided unit counts: new optional unit_count_col key feature. When
    supplied, pyncoda uses the per-building housing-unit counts directly (via
    residential_unit_var) instead of inferring them from occupancy type. Raises
    a clear ValueError if the requested column isn't in the inventory.
  • Skip figure/codebook generation: pass generate_figures=False and
    generate_codebook=False to process_community_workflow, so BRAILS skips
    pyncoda's IN-CORE figure and PDF codebook output it doesn't need.

GeoJSON RFC 7946 permits positions of 2 or more elements (e.g.
[lon, lat, altitude]), but BRAILS' InputValidator.validate_coordinates
and the downstream geometry pipeline assume strict 2-element pairs.
When a GeoJSON file uses 3D positions, every Asset fails validation
in Asset.__init__ and silently falls back to an empty coordinate list,
losing all geometry while spamming "Coordinates input is not a list"
warnings.

Slice each position to [:2] in parse_geojson_geometry across Point,
LineString, MultiLineString, Polygon, and MultiPolygon branches so
altitude (and any extra dimensions) is dropped before reaching the
2D-only validator. Split the previously combined LineString /
MultiLineString branch since their nesting depths differ.

It would be worth enhancing BRAILS functions in the future to work
with 3D coordinates so that the imported GeoJSON files can round-trip
without losing information.
…book generation

- Add optional 'unit_count_col' key feature: when provided, pyncoda uses the
  per-building housing unit counts directly (via residential_unit_var) instead
  of inferring them from occupancy type; raises ValueError if the column is
  missing from the inventory
- Pass generate_figures=False and generate_codebook=False to
  process_community_workflow so BRAILS skips pyncoda's IN-CORE figure and PDF
  codebook output
- update pyncoda pin to v3.0.0.post2

- Also bump BRAILS++ version to v4.3
@fmckenna
fmckenna merged commit e10fe18 into NHERI-SimCenter:master May 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants