Tool for preparing land use and parking inputs for ABM3 from Estimates and Forecasts outputs. Household and person processing is handled by the Population-Sim pipeline. There are three main parts of the tool:
- Process outputs of the 2022 parking inventory to impute missing data.
- Estimate regression models to predict the number of free and paid spaces in an MGRA.
- Create land use inputs for running ABM.
Unless there are changes to the base year network or inventory, only the third step needs to be run.
A dictionary of the settings in config.yaml can be found here.
Install uv on Windows from PowerShell:
winget install --id astral-sh.uv -eOpen a new terminal, navigate to the cloned repository, and create the environment:
uv syncuv downloads Python 3.10 if needed and installs the project dependencies into .venv.
Python 3.11 and 3.12 are also allowed; use uv sync --python 3.11 or
uv sync --python 3.12 to select one explicitly.
No environment activation is required. In VS Code, use
Python: Select Interpreter to select .venv\Scripts\python.exe.
Dependencies are defined in pyproject.toml; uv.lock records the resolved versions.
The geospatial dependencies use Shapely 1.x-compatible versions because
geonetworkx relies on APIs removed in Shapely 2. NumPy is kept below 2 for
compatibility with that stack.
Run either workflow from the repository root (replace the config name as needed):
uv run python run_landuse_preprocessing.py config_year.yaml
uv run python run_parking_preprocessing.py config_procpkg.yamlThe batch files also use uv and retain their fixed shared-drive script paths.
Before running the land use batch file, replace config_{year}.yaml in its
command with your config filename. The parking batch file uses config_procpkg.yaml.
To choose a config without editing a batch file, use the Python commands above.
Database access still requires the appropriate SQL Server ODBC driver installed on
Windows, database permissions, and access to any configured network drives. uv
installs pyodbc, not the system ODBC driver.
- Gain access to the database RP2025 on the server DGISWSQL22 from GIS.
- Create a directory to run in.
- Clone the repo into the directory.
- Create the Python environment with
uv sync(see above). - Open up config_[YEAR].yaml and set
run_ABM_preprocessto beTrue. - If no parking policy is being applied, set
implement_policyto beFalse. - Set
popsim_run_idto the PopulationSim run whose land use will be read from Databricks (see "To read PopulationSim outputs from Databricks" below). - Edit the
output_dirto the desired output location. - Update the name of config file with scenario year.
- Open PowerShell, navigate into the cloned repo and run
uv run python run_landuse_preprocessing.py config_[YEAR].yamlusing your renamed config file. The files will be created in the specifiedoutput_dir.
- Create a directory to run in and clone the repo into the directory. Create folders in the clone called "parking_processed" and "parking_inputs"
- Copy the the files auxiliary_columns.csv and micro_mobility_allyears.csv from T:\ABM\data\sr15_inputs\landuse_prep into the directory.
- Copy the file 'mgra_parking_inventory.csv' from T:\ABM\data\sr15_inputs\landuse_prep\parking_inputs into the parking_inputs folder ("old" folder not needed).
- Copy ParkingPolicies_[YEAR].csv from T:\ABM\data\sr15_inputs\landuse_prep\parking_outputs into the _processed folder.
- Open up config_procpkg.yaml and set
run_parking_inventory_preprocessand 'run_parking_space_estimation' to beTrue. - Edit the setting
base_luto be the directory with the outputs from Estimates and Forecasts that the land use prep tool will process. - Edit the setting
bike_netand 'bike_node' to be the directory with the latest active transportation network. - Open PowerShell, navigate into the cloned repo and create the Python environment with
uv sync. - Run
.\run_parking_preprocessing.bat. The files will be created in the specifiedparking_output_dir.
- secrets.yml
Copy secrets.example.yml to secrets.yml and fill in the workspace URL, SQL warehouse id, catalog and schema. This file is included in the .gitignore to keep it private.
databricks:
host: "<workspace-url>" # Databricks workspace URL
warehouse_id: "<warehouse-id>" # SQL Warehouse connection details
catalog: "<catalog>" # Catalog for PopulationSim output tables
schema: "<schema>" # Schema for PopulationSim output tables- config_[YEAR].yaml
Set popsim_run_id to the PopulationSim run to read. popsim_landuse_table is the Databricks table the land use is read from (silver_mgra_based_input).
Set hh_persons_from_databricks: True to also read that run's households and persons (popsim_households_table, popsim_persons_table) and write them to output_dir as households.csv and persons.csv. All tables are read over one connection, so you sign in once.
- Sign in
When the land use is read from Databricks, a browser window opens to sign in with your Databricks account.