Skip to content

Commit

Permalink
Merge branch 'ABM3_develop' of https://github.com/SANDAG/ABM into ABM…
Browse files Browse the repository at this point in the history
…3_develop
  • Loading branch information
aber-sandag committed Apr 30, 2024
2 parents c89fb76 + 84a9b38 commit 69c9fd7
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 24 deletions.
164 changes: 162 additions & 2 deletions docs/design.md

Large diffs are not rendered by default.

Binary file added docs/images/design/airport_model_design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/design/crossborder_model_design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/design/visitor_model_design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions src/asim/configs/airport.CBX/trip_mode_choice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,25 @@ CONSTANTS:
terminal: 1
central_mobility_hub: 2
nearest: 3
parkLocation1Mgra: 9350
terminalMgra: &terminalMgra 9350
parkLocation1Mgra: *terminalMgra
parkLocation2Mgra: -999
parkLocation3Mgra: -999
parkLocation4Mgra: -999
parkLocation5Mgra: -999
parkEscortLocationMgra: 9350
rentalLocationMgra: 9350
terminalMgra: 9350
parkEscortLocationMgra: *terminalMgra
rentalLocationMgra: *terminalMgra
centralMobilityHubMgra: 0
ridehailLocation1Mgra: 9350
ridehailLocation1Mgra: *terminalMgra
ridehailLocation2Mgra: -999
transitMgra: -999
curbLocation1Mgra: 9350
transitMgra: *terminalMgra
curbLocation1Mgra: *terminalMgra
curbLocation2Mgra: -999
curbLocation3Mgra: -999
curbLocation4Mgra: -999
curbLocation5Mgra: -999
shuttleVanLocation: terminalMgra
hotelCourtesyLocation: terminalMgra
shuttleVanLocation: *terminalMgra
hotelCourtesyLocation: *terminalMgra
orig_col_name: origin
dest_col_name: destination
costPerMile: 16.3
Expand Down
16 changes: 8 additions & 8 deletions src/asim/configs/airport.SAN/trip_mode_choice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ CONSTANTS:
terminal: 1
central_mobility_hub: 2
nearest: 3
parkLocation1Mgra: 11249
terminalMgra: &terminalMgra 11249
parkLocation1Mgra: *terminalMgra
parkLocation2Mgra: -999
parkLocation3Mgra: -999
parkLocation4Mgra: 6528
parkLocation5Mgra: 2802
parkEscortLocationMgra: 11249
parkEscortLocationMgra: *terminalMgra
rentalLocationMgra: 2994
terminalMgra: 11249
centralMobilityHubMgra: 0
ridehailLocation1Mgra: 11249
ridehailLocation1Mgra: *terminalMgra
ridehailLocation2Mgra: -999
transitMgra: -999
curbLocation1Mgra: 11249
transitMgra: *terminalMgra
curbLocation1Mgra: *terminalMgra
curbLocation2Mgra: -999
curbLocation3Mgra: -999
curbLocation4Mgra: -999
curbLocation5Mgra: -999
shuttleVanLocation: terminalMgra
hotelCourtesyLocation: terminalMgra
shuttleVanLocation: *terminalMgra
hotelCourtesyLocation: *terminalMgra
orig_col_name: origin
dest_col_name: destination
costPerMile: 16.3
Expand Down
118 changes: 118 additions & 0 deletions src/asim/configs/common/outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,43 @@ trips:
- is_drive_loc
- is_drive_prm
- is_drive_mix
- vot_da
- vot_s2
- vot_s3
- parkingCost
- is_ea
- is_am
- is_md
- is_pm
- is_ev
- ownTrp
- vot1
- vot2
- vot3
- vot_bin_da
- vot_bin_s2
- vot_bin_s3
- failed
- parkLocation1Cost
- parkLocation2Cost
- parkLocation3Cost
- parkLocation4Cost
- parkLocation5Cost
- partySizeRideHailLocation1AutoDist
- partySizeRideHailLocation2AutoDist
- s2_dist_skims
- s2_time_skims
- s2_cost_skims
- c_ivt
- c_fwt
- c_xwt
- c_wacc
- c_wegr
- c_waux
- c_xfers
- c_walk_time
- c_xfers_pnr
- cost_per_mile

rename_columns:
distance: distance_total
Expand Down Expand Up @@ -583,6 +620,33 @@ households:
- emp_non_ws_oth
- budgetroom
- economyroom
- hh_work_auto_savings_ratio
- adultschenrl
- total_emp_revised
- num_children
- num_young_children
- num_children_6_to_12
- num_children_5_to_15
- num_children_16_to_17
- num_gradeschool
- num_highschool
- num_college_age
- num_young_adults
- num_predrive_child
- num_nonworker_adults
- num_university_students
- num_fullTime_workers
- num_partTime_workers
- num_retired_adults
- num_highschool_graduates
- num_children_6_to_15
- num_young_retirees
- num_old_retirees
- non_family
- family
- home_is_urban
- home_is_rural
- num_hh_in_zone
rename_columns:
bldgsz: building_category
hhid: household_id
Expand Down Expand Up @@ -786,11 +850,65 @@ land_use:
persons:
remove_columns:
- naics2_original_code
- age_16_to_19
- age_16_p
- adult
- male
- female
- has_non_worker
- has_retiree
- has_preschool_kid
- has_driving_kid
- has_school_kid
- has_full_time
- has_part_time
- has_university
- student_is_employed
- nonstudent_to_school
- is_preschool
- is_gradeschool
- is_highschool
- is_university
- is_fulltime_worker
- is_parttime_worker
- is_income_less25K
- is_income_25K_to_60K
- is_income_60K_to_120K
- is_income_greater60K
- is_income_greater120K
- is_non_worker_in_HH
- is_all_adults_full_time_workers
- is_pre_drive_child_in_HH
- workplace_in_cbd
- under16_not_at_school
- has_preschool_kid_at_home
- has_school_kid_at_home
- work_and_school_and_worker
- work_and_school_and_student
- has_pre_school_child_with_mandatory
- has_driving_age_child_with_mandatory
- num_non_escort_tours
- num_shop_maint_tours
- num_shop_maint_escort_tours
- num_soc_discr_tours
- demographic_segment
- time_distrib_mean_work
- time_distrib_stddev_nonwork
- time_distrib_mean_nonwork
- time_distrib_stddev_work

rename_columns:
rac1p: race
hisp: hispanic
perid: person_id

tours:
remove_columns:
- tour_id_temp
- purpose
- mode_segment
- parent_tour_id
- free_parking_at_work

rename_columns:
vehicle_occup_3.5: vehicle_occup_3_5
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Description,Target,Expression
,_destination,"np.where((df.trip_mode == 'PARK_ESCORT') & (df.outbound == False), parkEscortLocationMgra, _destination)"
,_destination,"np.where((df.trip_mode == 'RENTAL') & (df.outbound == False), rentalLocationMgra, _destination)"
,_destination,"np.where((df.trip_mode == 'SHUTTLEVAN') & (df.outbound == False), shuttleVanLocation, _destination)"
,_destination,"np.where((df.trip_mode == 'HOTEL_COURTESY') & (df.outbound == False), hotelCourtesyMgra, _destination)"
,_destination,"np.where((df.trip_mode == 'HOTEL_COURTESY') & (df.outbound == False), hotelCourtesyLocation, _destination)"
,_destination,"np.where((df.trip_mode == 'RIDEHAIL_LOC1') & (df.outbound == False), ridehailLocation1Mgra, _destination)"
,_destination,"np.where((df.trip_mode == 'RIDEHAIL_LOC2') & (df.outbound == False), ridehailLocation2Mgra, _destination)"
,_destination,"np.where((df.trip_mode == 'TAXI_LOC1') & (df.outbound == False), ridehailLocation1Mgra, _destination)"
Expand All @@ -40,7 +40,7 @@ Description,Target,Expression
,_origin,"np.where((df.trip_mode == 'PARK_ESCORT') & (df.outbound == True), parkEscortLocationMgra, _origin)"
,_origin,"np.where((df.trip_mode == 'RENTAL') & (df.outbound == True), rentalLocationMgra, _origin)"
,_origin,"np.where((df.trip_mode == 'SHUTTLEVAN') & (df.outbound == True), shuttleVanLocation, _origin)"
,_origin,"np.where((df.trip_mode == 'HOTEL_COURTESY') & (df.outbound == True), hotelCourtesyMgra, _origin)"
,_origin,"np.where((df.trip_mode == 'HOTEL_COURTESY') & (df.outbound == True), hotelCourtesyLocation, _origin)"
,_origin,"np.where((df.trip_mode == 'RIDEHAIL_LOC1') & (df.outbound == True), ridehailLocation1Mgra, _origin)"
,_origin,"np.where((df.trip_mode == 'RIDEHAIL_LOC2') & (df.outbound == True), ridehailLocation2Mgra, _origin)"
,_origin,"np.where((df.trip_mode == 'TAXI_LOC1') & (df.outbound == True), ridehailLocation1Mgra, _origin)"
Expand Down
6 changes: 3 additions & 3 deletions src/asim/extensions/update_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def update_tables():
output_table = pipeline.get_table(table_name)

# set sample rate to float
if table_name == "households":
if table_name == "households" and setting("model_name") == "resident":
output_table["sample_rate"] = output_table["sample_rate"].astype(float)
input_households = pd.read_csv(os.path.join(input_dir,"households.csv"),
usecols=[
Expand All @@ -240,14 +240,14 @@ def update_tables():
output_table = output_table.merge(input_households,how="inner",left_on="household_id",right_on="hhid")

# split vehicle_type column
if table_name == "vehicles":
if table_name == "vehicles" and setting("model_name") == "resident":
output_table[["vehicle_category", "num_occupants", "fuel_type"]] = output_table[
"vehicle_type"
].str.split(pat="_", expand=True)
# output_table.drop(columns={'vehicle_type'}, inplace=True) ## TODO decide whether to drop column here or in bronze -> silver filter

# add missing columns from input persons file
if table_name == "persons":
if table_name == "persons" and setting("model_name") == "resident":
input_persons = pd.read_csv(os.path.join(input_dir,"persons.csv"),
usecols=[
"perid",
Expand Down

0 comments on commit 69c9fd7

Please sign in to comment.