h3_robustness¶
H3 hexagonal aggregation for MAUP robustness testing.
h3_robustness
¶
H3 hexagonal aggregation for MAUP robustness testing.
Aggregates segment-level traffic data to Uber H3 hexagons at multiple resolutions, then re-runs Global Moran's I to test whether null spatial autocorrelation results persist at neighbourhood scales.
h3_aggregate
¶
Aggregate segment values to H3 hexagons at resolution.
Requires the h3 package (pip install h3).
Returns a GeoDataFrame indexed by H3 cell with columns:
h3_index, mean, median, std, count, geometry.
Source code in src/trafficpipeline/h3_robustness.py
h3_moran
¶
Compute Global Moran's I on H3-aggregated data.
Returns dict with morans_i, z_score, p_value,
n_hexagons.
Source code in src/trafficpipeline/h3_robustness.py
resolution_sweep
¶
Run Moran's I at multiple H3 resolutions.
Returns DataFrame with columns: resolution, n_hexagons, morans_i, z_score, p_value, significant.
Source code in src/trafficpipeline/h3_robustness.py
plot_resolution_sweep
¶
Line plot of Moran's I across resolutions per city.
Source code in src/trafficpipeline/h3_robustness.py
plot_h3_map
¶
Choropleth map of H3-aggregated congestion.
Source code in src/trafficpipeline/h3_robustness.py
run_analysis
¶
run_analysis(base_dir='.', figures_dir='figures', output_dir='analysis_results', period='evening_peak', resolutions=None)
Run H3 hexagonal robustness analysis for all cities.