Repository navigation
WP1.9: Add public transport accessibility indicator (SDG 11.2.1) - #7
FlorianNachtigall wants to merge 1 commit into
Conversation
Integrate SDG 11.2.1 PT accessibility into preprocessing and UI metrics, regenerate cities data, and archive one-off mapping notebook under preprocessing/public-transport-accessibility. Keep local merge CSV untracked via .gitignore. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
🚀 Preview deployed for this PR: https://ai4up.github.io/cities-learning-explorer/pr-7/ This comment is kept up to date automatically. |
816b03b to
73f3b5b
Compare
SimonMontfort
left a comment
There was a problem hiding this comment.
one specific comment check; otherwise good to go from my point of view.
| "gdf_pt_access['region'] = gdf_pt_access['CTR_MN_NM'].replace(country_rename).map(cities_ipcc.drop_duplicates(subset='country').set_index('country')['region'])\n", | ||
| "gdf_pt_access['population_density'] = gdf_pt_access['Total_POP'] / gdf_pt_access.to_crs(cities_ipcc.crs).area.div(1e6)\n", | ||
| "gdf_pt_access_norm = normalize_popdens(gdf_pt_access.rename(columns={'CTR_MN_NM': 'country'}), popdens_col='population_density',\n", |
There was a problem hiding this comment.
country_rename isn't applied here, so 6 countries may get imputed values
This renames the column CTR_MN_NM to country. The values keep the SDG spelling ('Mexico', 'Czech Republic', 'Cape Verde', …), while result['country'] uses the other spelling ('México', 'Czechia', 'Cabo Verde', …).
In gwr_infill_missing, the loop iterates over donor countries and looks up receivers with out[country_col] == country. For 'Mexico' it finds no receivers and continues, and 'México' is never visited. So every missing city in México, Czechia, Cabo Verde, North Macedonia, Palestine and Republic of the Congo silently stays unfilled.
Suggested fix (ideally the country line would go right after loading the shapefile, so it can be reused everywhere):
| "gdf_pt_access['region'] = gdf_pt_access['CTR_MN_NM'].replace(country_rename).map(cities_ipcc.drop_duplicates(subset='country').set_index('country')['region'])\n", | |
| "gdf_pt_access['population_density'] = gdf_pt_access['Total_POP'] / gdf_pt_access.to_crs(cities_ipcc.crs).area.div(1e6)\n", | |
| "gdf_pt_access_norm = normalize_popdens(gdf_pt_access.rename(columns={'CTR_MN_NM': 'country'}), popdens_col='population_density',\n", | |
| "gdf_pt_access['country'] = gdf_pt_access['CTR_MN_NM'].replace(country_rename)\n", | |
| "gdf_pt_access['region'] = gdf_pt_access['country'].map(cities_ipcc.drop_duplicates(subset='country').set_index('country')['region'])\n", | |
| "gdf_pt_access['population_density'] = gdf_pt_access['Total_POP'] / gdf_pt_access.to_crs(cities_ipcc.crs).area.div(1e6)\n", | |
| "gdf_pt_access_norm = normalize_popdens(gdf_pt_access, popdens_col='population_density',\n", |
I have not run the entire code though and checked. So before accepting, it may be worthwhile to check this.
Summary
public_transport_accessibilityto exported city characteristics/percentiles and regeneratepublic/cities.jsonpreprocessing/public-transport-accessibility/.gitignoreNotes
Map visualization of indicator-city matching results and NaN-fill logic via geographically weighted regression
cities_pt_access_infill_map.html
Closes #6