Skip to content

Commit

Permalink
Merge pull request #231 from SANDAG/external_zones_fix
Browse files Browse the repository at this point in the history
Fix external zones not added to i,j columns in walk skims
  • Loading branch information
bhargavasana authored Oct 30, 2024
2 parents c5996c5 + 7ec1944 commit b347bd7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/asim/scripts/resident/resident_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,15 @@ def add_external_stations_to_skim_df(self, skim_df, maz_ext_taz_xwalk, landuse,
od_connections = skim_df.loc[skim_df[origin_col] == closest_maz].copy()
print(f"\t origins with this internal maz {len(od_connections)}")
od_connections[origin_col] = ext_maz
if "i" in skim_df.columns:
od_connections["i"] = ext_maz
new_connections.append(od_connections)

if dest_col is not None:
do_connections = skim_df.loc[skim_df[dest_col] == closest_maz].copy()
do_connections[dest_col] = ext_maz
if "j" in skim_df.columns:
do_connections["j"] = ext_maz
print(f"\t destinations with this internal maz {len(do_connections)}")
new_connections.append(do_connections)

Expand Down
16 changes: 8 additions & 8 deletions src/main/python/TravelTimeReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ def read_active_skims(self):
self.settings["active_skim_files"][skim_name]
)
)
if not "i" in active_skims.columns:
active_skims = active_skims.rename(
columns = {
"OMAZ": "i",
"DMAZ": "j",
}
)
self.skims[skim_name] = active_skims.set_index(
if "i" in active_skims.columns:
active_skims = active_skims.drop(["i", "j"],axis=1)
self.skims[skim_name] = active_skims.rename(
columns = {
"OMAZ": "i",
"DMAZ": "j",
}
).set_index(
["i", "j"]
)

Expand Down

0 comments on commit b347bd7

Please sign in to comment.