Skip to content

debris

Debris reach, pressure, corridor blockage, navigable core and closed roads.

quakecascade.debris

Debris reach, debris pressure and street closure after building collapse.

The module joins building damage to the road network in four steps:

  1. reach_pairs finds every building/road pair where the building's debris could physically land on the carriageway. The bound needs no coefficient: debris cannot land farther from the footprint than the building is tall.
  2. debris_pressure combines the complete-damage probabilities of the buildings that reach each road into an upper-bound probability that at least one of them collapses onto it, and an expected number of collapses per 100 m.
  3. debris_extent, debris_envelope and corridor_blockage turn a collapse realisation into debris polygons and the share of each road corridor they cover, with an explicit closure threshold.
  4. navigable_core and navigable_roads keep only the street space wide enough for a vehicle and return the ids of roads that no longer carry one, ready for RoadNetwork.without(edge_ids).

Every distance is in metres. Inputs are Shapely geometry arrays or GeoDataFrames/GeoSeries; when a CRS is attached it must be a projected metric CRS (quakecascade.crs.require_metric). Plain arrays carry no CRS, so their units are the caller's responsibility.

Calibration notes. The debris spread factor k, the solid volume ratio, the void ratio, the material density, the released-material fraction per damage state and the closure share are screening constants without a single verified value. They are therefore required arguments; the docstrings give the literature range where one exists.

DAMAGE_STATES module-attribute

DAMAGE_STATES = (
    "none",
    "slight",
    "moderate",
    "extensive",
    "complete",
)

Hazus damage-state labels in increasing severity (FEMA, 2024, Hazus 6.1 Earthquake Model Technical Manual, building damage states).

NO_REACH module-attribute

NO_REACH = EMPTY

Status when no building reaches the road: the zero is a true value. Equal to quakecascade.contract.EMPTY.

NO_DAMAGE module-attribute

NO_DAMAGE = missing('damage')

Status when every reaching building lacks a damage probability.

NO_WIDTH module-attribute

NO_WIDTH = missing('width')

Status when a road has no usable corridor width.

NO_HEIGHT module-attribute

NO_HEIGHT = missing('height')

Status when the only buildings that may reach a road have no usable height.

NARROWER_THAN_CLEAR_WIDTH module-attribute

NARROWER_THAN_CLEAR_WIDTH = 'narrower_than_clear_width'

Status when a road is narrower than the vehicle clear width even before debris (registered in quakecascade.contract.REGISTERED_STATUSES).

DebrisExtent

Bases: NamedTuple

Per-building debris quantities; unpacks like the PlanX 4-tuple.

reach_pairs

reach_pairs(
    buildings_geom,
    heights_m,
    roads_geom,
    road_widths_m=None,
    *,
    building_ids=None,
    road_ids=None,
    crs=None,
    unknown_height_reach_m=None,
)

Building/road pairs where a collapsing building's debris can reach the carriageway.

Physical bound, no coefficient: debris cannot land farther from the footprint than the building is tall. Distance d is measured from the footprint polygon to the road centreline. Without widths the road is the centreline itself; with widths w the carriageway edge lies w / 2 from the centreline, so the clearance is d - w / 2. A pair is kept when clearance < height (strict, as in the source).

Parameters:

Name Type Description Default
buildings_geom GeoDataFrame, GeoSeries or sequence of Shapely geometries

Building footprints in a metric CRS.

required
heights_m (array - like, scalar or str)

Building height in metres (a column name of buildings_geom is accepted). A building with a non-finite or non-positive height is not dropped: it is paired with every road within unknown_height_reach_m as a possible reacher, with height_m NaN, so the roads it may reach are never read as free of debris. Such buildings are counted in result.attrs["buildings_without_height"].

required
roads_geom GeoDataFrame, GeoSeries or sequence of Shapely geometries

Road centrelines (or road polygons, then road_widths_m=None).

required
road_widths_m (array - like, scalar, str or None)

Full carriageway width in metres. None measures to the geometry.

None
building_ids array - like or str

Stable ids carried into the output; default is row order.

None
road_ids array - like or str

Stable ids carried into the output; default is row order.

None
crs optional

CRS of plain geometry arrays, checked to be metric. Inputs that carry different CRSs raise CRSError.

None
unknown_height_reach_m float

Reach (m) assumed for buildings without a usable height, stored in result.attrs["unknown_height_reach_m"]. Required as soon as one such building exists (a planning choice, e.g. the tallest building that may lack a height); there is no default.

None

Returns:

Type Description
DataFrame

One row per pair: building and road (row positions), building_id, road_id, height_m (NaN for a possible reacher of unknown height), distance_m (footprint to centreline) and clearance_m (footprint to carriageway edge). Corner buildings appear once per road they reach.

Notes

Re-implements the author's earlier road-exposure debris-reach rule with a vectorised Shapely 2 STRtree dwithin query.

debris_pressure

debris_pressure(
    p_complete,
    pairs,
    n_roads=None,
    road_length_m=None,
    *,
    road_ids=None,
)

Debris pressure per road from the complete-damage probabilities of reaching buildings.

For road \(r\) with reaching buildings \(B_r\) that carry a probability \(p_i\) of the Hazus complete damage state:

\[ P_r = 1 - \prod_{i \in B_r} (1 - p_i), \qquad E_r = \sum_{i \in B_r} p_i, \qquad D_r = 100\, E_r / L_r \]

\(P_r\) assumes independent collapses and counts every reaching building as landing on the road, so it is an upper bound on the probability that debris reaches the carriageway. It saturates on dense streets; \(D_r\) (expected collapses per 100 m) keeps the ranking. Buildings of unknown height that may reach the road (height_m NaN in pairs) cannot be scored; they make the road partial (or no_height when no other building reaches it), never empty.

Parameters:

Name Type Description Default
p_complete array - like

Probability of complete damage per building, indexed by the building row position used in pairs. NaN means unknown.

required
pairs DataFrame

Output of reach_pairs.

required
n_roads int

Number of roads; inferred from road_length_m or pairs.attrs.

None
road_length_m array - like

Road length in metres; adds expected_per_100m.

None
road_ids array - like

Stable road ids; default the ids reach_pairs stored in pairs.attrs["road_ids"], else row order.

None

Returns:

Type Description
DataFrame

One row per road: road, road_id, reaching_buildings, reaching_without_p, reaching_without_height, p_any_collapse, expected_collapsed, optional length_m and expected_per_100m, and debris_status:

  • computed: every reaching building has a probability;
  • partial: some lack one, or a building of unknown height may also reach the road; the values use the known ones and are lower bounds of the full-information value;
  • no_damage: no reaching building has a probability; values NaN;
  • no_height: only buildings of unknown height may reach it; values NaN;
  • empty: no building reaches the road; values are a true 0.
Notes

Mirrors the status semantics of the author's earlier road-exposure stage (no reaching building / no input / partial / computed), re-implemented.

debris_extent

debris_extent(
    height_m,
    area_m2,
    state_factor,
    *,
    debris_factor=None,
    solid_volume_ratio=None,
    void_ratio=None,
    density_t_m3=None,
)

Debris radius, solid volume, pile volume and mass per building.

\[ r = k\, H\, f, \quad V_s = A\, H\, \rho_s\, f, \quad V_p = V_s / (1 - e), \quad M = \gamma\, V_s \]

with height \(H\) (m), footprint area \(A\) (m²), released-material fraction \(f \in [0, 1]\) (clipped), spread factor \(k\), solid volume ratio \(\rho_s\), void ratio \(e\) and the density \(\gamma\) (t/m³) of the void-free material, since the mass is taken from the solid volume. Radius scales linearly with \(f\), the conservative choice for screening.

Parameters:

Name Type Description Default
height_m array - like

Height (m), footprint ground area (m², measured in a metric CRS) and released-material fraction (1 = total collapse).

required
area_m2 array - like

Height (m), footprint ground area (m², measured in a metric CRS) and released-material fraction (1 = total collapse).

required
state_factor array - like

Height (m), footprint ground area (m², measured in a metric CRS) and released-material fraction (1 = total collapse).

required
debris_factor (float, required)

k, fraction of building height thrown horizontally for a total collapse. Literature range about 0.15–0.67: 0.15–0.5 falling with height, simulated envelope 0.57 (Wang et al., 2020, doi:10.1155/2020/7034517); 1/2–2/3 of height in China's GB/T 51327 (as reported by Zheng et al., 2025, doi:10.3390/buildings15091481).

None
solid_volume_ratio (float, required)

Fraction of the gross building volume that is material. No verified source; PlanX's screening value was 0.3.

None
void_ratio (float, required)

Air share of the pile's bulk volume. No verified source; rubble piles are commonly described in the 0.3–0.5 range (PlanX screening value 0.35).

None
density_t_m3 (float, required)

Density of the solid, void-free material (t/m³); it multiplies the solid volume. No verified source (PlanX screening value 1.8). A rubble bulk density (about 1.4–1.9 t/m³, voids included) belongs with the pile volume instead (mass = bulk density × pile_m3); used here it would understate the mass by the factor 1 − e.

None

Returns:

Type Description
DebrisExtent

(radius_m, solid_m3, pile_m3, mass_t).

Notes

Ported from PlanX engine/seismic.py debris_extent with the arithmetic unchanged; the former defaults are now required.

material_factor

material_factor(
    damage_state, factors, states=DAMAGE_STATES
)

Released-material fraction per building from its damage state.

Parameters:

Name Type Description Default
damage_state array-like of str or int

State labels, or integer indices into states.

required
factors (mapping, required)

Fraction released per state, e.g. {"complete": 1.0, ...}. No calibrated values exist; PlanX used an uncalibrated ordering (none 0, slight 0, moderate 0.10, extensive 0.35, complete 1.0). Every state in states must be present.

required
states sequence of str

State order for integer input; default Hazus labels.

DAMAGE_STATES

parse_width_m

parse_width_m(value)

Lenient road-width parser: 7, "6.5", "6,5 m", "12 metres".

Returns float metres, or None when the value is missing, non-numeric, non-positive or in another unit ("5 km"). Ported from PlanX.

highway_width_m

highway_width_m(highway_class, class_widths, fallback=None)

Carriageway width (m) for a road class from a caller-supplied table.

Matching is case- and whitespace-tolerant and "_link" variants inherit the parent class. No width table ships with the package: typical widths per class are local design choices, so class_widths is required. Unknown or missing classes get fallback, or NaN when it is None.

Accepts a scalar (returns float) or an array-like (returns ndarray).

debris_envelope

debris_envelope(
    buildings_geom,
    collapsed,
    heights_m,
    k=None,
    *,
    state_factor=None,
    crs=None,
)

Debris polygon per building: the footprint grown by r = k · H · f.

Parameters:

Name Type Description Default
buildings_geom GeoDataFrame, GeoSeries or geometry sequence

Footprints in a metric CRS.

required
collapsed array-like of bool

Buildings that release debris in this realisation.

required
heights_m (array - like, scalar or str)

Height in metres.

required
k (float, required)

Debris spread factor (see debris_extent for the range).

None
state_factor array - like

Released-material fraction per building (default 1 where collapsed).

None

Returns:

Type Description
numpy.ndarray of object

Shapely polygon per building, None where nothing is released or the height is unknown (see unknown_height_envelope for the latter). Buffers use square caps and mitred joins (limit 2), as in the PlanX seismic-debris tool.

unknown_height_envelope

unknown_height_envelope(
    buildings_geom,
    collapsed,
    heights_m,
    k=None,
    *,
    unknown_height_reach_m=None,
    state_factor=None,
    crs=None,
)

Where debris of collapsed buildings without a usable height may land.

The footprint grown by k · H_u · f, with H_u the unknown_height_reach_m bound of reach_pairs (required when such a building exists). These polygons are not debris: a road they touch is not closed by them, but its blockage or passability can no longer be stated as complete.

Returns:

Type Description
numpy.ndarray of object

Polygon per collapsed building of unknown height, None elsewhere.

road_corridors

road_corridors(roads_geom, road_widths_m, *, crs=None)

Corridor polygon per road: the centreline buffered by half its width (round caps).

Roads of zero width give an empty polygon.

corridor_blockage

corridor_blockage(
    buildings_geom,
    roads_geom,
    collapsed,
    *,
    heights_m,
    k=None,
    closed_share=None,
    road_widths_m=None,
    state_factor=None,
    road_ids=None,
    crs=None,
    unknown_height_reach_m=None,
    uncertain=None,
)

Share of each road corridor covered by debris, and a closure flag.

\[ s_r = \frac{|C_r \cap \bigcup_i D_i|}{|C_r|}, \qquad \text{closed}_r = s_r \ge s^{*} \]

with corridor \(C_r\) (centreline buffered by half the width) and debris polygons \(D_i\) from debris_envelope.

Parameters:

Name Type Description Default
buildings_geom

Footprints and centrelines in a metric CRS.

required
roads_geom

Footprints and centrelines in a metric CRS.

required
collapsed array-like of bool

Collapse realisation per building.

required
heights_m (array - like, scalar or str)

Building height (m).

required
k (float, required)

Debris spread factor (see debris_extent).

None
closed_share (float, required)

Blocked share \(s^*\) at or above which a road counts as closed. No verified source; the IP3 screening study used 0.50.

None
road_widths_m (array - like, scalar or str, required)

Full carriageway width (m).

None
state_factor array - like

Released-material fraction per building.

None
road_ids array - like or str

Stable ids (default row order), as used by RoadNetwork.without.

None
unknown_height_reach_m float

Height bound for collapsed buildings without a usable height (see unknown_height_envelope); required when one exists.

None
uncertain Shapely geometry, sequence or GeoSeries

Further areas where debris of unknown extent may lie, e.g. the envelopes of buildings whose damage state could not be computed.

None

Returns:

Type Description
DataFrame

Per road: road, road_id, corridor_area_m2, blocked_area_m2, blocked_share, closed and blockage_status: computed; partial where known debris covers part of the corridor and debris of unknown extent may cover more (the share is a lower bound; closed reflects the known debris only); no_height / no_damage (NaN share) where only debris of unknown extent - from a collapsed building without a height, or from uncertain - may touch the corridor; no_width with NaN share where the corridor has no area.

Notes

Re-implements the buffer/union/intersection pass of the IP3 seismic-debris analysis (detailed_planx_pass), vectorised with an STRtree.

closed_road_ids

closed_road_ids(frame, column=None)

Ids of roads closed by debris, from corridor_blockage or navigable_roads.

column defaults to closed (blockage) or not passable (navigable). For a navigable frame only roads that a vehicle could use before the debris count (status computed or partial); roads that were never passable (narrower_than_clear_width, no_width) are listed by impassable_road_ids instead, so a before/after comparison can drop them from both networks. The result feeds RoadNetwork.without.

impassable_road_ids

impassable_road_ids(frame)

Ids of roads a vehicle of the clear width cannot use even without debris.

From navigable_roads: status narrower_than_clear_width or no_width. They belong out of the pre-event and the post-event network; closing them only after the event would count them as debris closures.

navigable_core

navigable_core(
    corridors, clear_width_m=None, *, tolerance_m=0.001
)

Open street space narrowed to a minimum clear width (morphological opening).

Erode by half the clear width, then regrow by the same amount: every part too narrow for a vehicle of width clear_width_m disappears, so a 0.5 m sliver beside a debris pile stops counting as a route. The opening uses clear_width_m / 2 - tolerance_m so that a space exactly as wide as the vehicle survives the erosion instead of collapsing to a line.

Parameters:

Name Type Description Default
corridors Shapely geometry or array of geometries

Open corridor polygons (street space minus debris), metric units.

required
clear_width_m (float, required)

Minimum clear width (m). A local operational choice (vehicle width plus margin); no default.

None
tolerance_m float

Geometric tolerance (m), not a model coefficient: spaces narrower than the clear width by less than 2 * tolerance_m are kept.

0.001

Returns:

Type Description
Shapely geometry or ndarray

Same shape as the input. clear_width_m <= 0 returns the input.

Notes

Re-implements PlanX alg_seismic_debris._navigable_core (buffer with 8 segments per quadrant, then make_valid).

navigable_roads

navigable_roads(
    roads_geom,
    debris,
    road_widths_m,
    clear_width_m=None,
    *,
    road_ids=None,
    crs=None,
    tolerance_m=1e-06,
    width_tolerance_m=0.001,
    uncertain=None,
)

Per-road passability after debris: does a vehicle still get from end to end?

For each road the open corridor is \(C_r \setminus \bigcup_i D_i\); its navigable_core at clear_width_m is computed, and the road is passable when one connected part of the core touches both centreline end points. With round-capped corridors an undisturbed road is passable exactly when its width is at least the clear width.

Parameters:

Name Type Description Default
roads_geom GeoDataFrame, GeoSeries or geometry sequence

Road centrelines (LineStrings) in a metric CRS.

required
debris Shapely geometry or sequence

Debris polygons (e.g. debris_envelope); None entries ignored.

required
road_widths_m (array - like, scalar or str)

Full carriageway width (m).

required
clear_width_m (float, required)

Minimum clear width (m).

None
road_ids array - like or str

Stable ids (default row order).

None
tolerance_m float

Numerical tolerance for touching an end point (geometric, not a model coefficient).

1e-06
width_tolerance_m float

Tolerance of the clear-width opening (navigable_core).

0.001
uncertain Shapely geometry or sequence

Areas where debris of unknown extent may lie (unknown_height_envelope). They do not block a road, but a road they touch reads partial: its passability is an upper bound.

None

Returns:

Type Description
DataFrame

Per road: road, road_id, open_area_m2, core_area_m2, passable and navigable_status: computed; partial (touched by uncertain); no_width (zero width, not passable); narrower_than_clear_width (not passable even without debris, so the closure is not caused by debris). Use closed_road_ids for the debris closures and impassable_road_ids for the roads that were never passable.