Skip to content

Commit

Permalink
Merge pull request #61 from Urban-Analytics-Technology-Platform/58-gr…
Browse files Browse the repository at this point in the history
…eater-london

Modifications for Greater London (#58)
  • Loading branch information
sgreenbury authored Nov 1, 2024
2 parents 3004f28 + 72c7c21 commit 82850ee
Show file tree
Hide file tree
Showing 15 changed files with 286 additions and 283 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,9 @@ logs/

# pyright config
pyrightconfig.json

# scratch
notebooks/scratch*

# AcBM config
config/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.0"
rev: "v0.7.0"
hooks:
# first, lint + autofix
- id: ruff
Expand Down
14 changes: 12 additions & 2 deletions config/base.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
[parameters]
seed = 0
region = "leeds"
number_of_households = 10000
number_of_households = 5000
zone_id = "OA21CD"
travel_times = true # Only set to true if you have travel time matrix at the level specified in boundary_geography
travel_times = true # Only set to true if you have travel time matrix at the level specified in boundary_geography
boundary_geography = "OA"

[matching]
required_columns = ["number_adults", "number_children"]
optional_columns = [
"number_cars",
"num_pension_age",
"rural_urban_2_categories",
"employment_status",
"tenure_status",
]
n_matches = 10

[work_assignment]
use_percentages = true
Expand Down
14 changes: 0 additions & 14 deletions config/base_500.toml

This file was deleted.

13 changes: 0 additions & 13 deletions config/base_5000.toml

This file was deleted.

13 changes: 0 additions & 13 deletions config/base_all.toml

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/1_prep_synthpop.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,6 @@ def main(config_file):
acbm.root_path / f"data/external/spc_output/{region}_people_hh.parquet"
)

# People and time-use data
# Subset of (non-time-use) features to include and unnest
# The features can be found here: https://github.com/alan-turing-institute/uatk-spc/blob/main/synthpop.proto
features = {
"health": [
"bmi",
"has_cardiovascular_disease",
"has_diabetes",
"has_high_blood_pressure",
"self_assessed_health",
"life_satisfaction",
],
"demographics": ["age_years", "ethnicity", "sex", "nssec8"],
"employment": ["sic1d2007", "sic2d2007", "pwkstat", "salary_yearly"],
}

# build the table
spc_people_tu = (
Builder(path, region, backend="polars", input_type="parquet")
.add_households()
.add_time_use_diaries(features, diary_type="weekday_diaries")
.build()
)

# save the output
spc_people_tu.write_parquet(
acbm.root_path / f"data/external/spc_output/{region}_people_tu.parquet"
)


if __name__ == "__main__":
main()
Loading

0 comments on commit 82850ee

Please sign in to comment.