Source code for "Urban Dynamics Through the Lens of Human Mobility"
Developed by Yanyan Xu (yanyanxu@sjtu.edu.cn) and Marta Gonzalez, Human Mobility and Networks Lab (http://humnetlab.berkeley.edu/), UC Berkeley
Data were analyzed using python 3.8.7, numpy 1.19.5, scipy 1.6.0, pandas 1.2.1, osgeo 2.2.3, lightgbm 3.1.1, shap 0.40.0, matplotlib 3.5.2, seaborn 0.11.1. The code were compiled in Ubuntu 18.04.
The estiamte of
This data analysis framework aggregates the individual mobility traces data, to quantify the collective mobility beahavior from two aspects,
(I) urban form metric $\Delta KS$ , a metric to measure the spatial heterogeneity of mobility scale (Rg);
(II) "shelter-at-home" indicator $KS_{HBT}$ , a metric to measure the "staying-at-home" of the population in a city.
For each user, we first calcualte her Raduis of Gyration (
where
To understand the urban form from the respective of human mobility, we group population in one city with circiles centering at the CBD, as presented in the following figure. Then we define
Next, we define another metric
This work is implemented with Python3.9. Related packages include numpy, pandas, scipy, matplotlib, seaborn, lightgbm, shap, geojson, fiona, rtee.
(1) cityGiniPopulation(cities): extracting the population information of a given city from LandScan data.
(2) RgDistribution(city): grouping and visualize the Rg values of users in a given city.
(1) KSIndexVSdistance(cities): calculation of KS index in rings centering at CBD for a given city.
(2) typicalBehavior(city): calculation of
Process the covid-19 data in Spain and visualize the data.
Socio-economic analysis for Boston, LA, and Bogota cities.
Plot the figures in the Supplymentary Information for our paper.
(1) Urban form changing during COVID-19 peroid (before Sep. 30th, 2020) in Spain.
(2) Modeling the spread of COVID-19 with mobility and urban form variables in 11 Spanish cities with GBM model, and explain the impacts of variables with SHAP package.
We use the EpiEstim R package (https://cran.r-project.org/web/packages/EpiEstim/) to estiamte the time-varying reproduction number
For one city, the required data to reproduce the results include:
(1) shapefile of the city region and its boundary, the geographic location of CBD
(2) popualtion distribution at 1km2 resolution
(3) the mobile traces (a sequence of stay locations) of a large number of residents or their daily