Skip to content

Commit

Permalink
move land_use_taz check
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Jul 24, 2023
1 parent c5ea52c commit 8cc0a42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 0 additions & 8 deletions activitysim/abm/tables/landuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ def land_use_taz(state: workflow.State):
df.info(buf=buffer)
logger.debug("land_use_taz.info:\n" + buffer.getvalue())

# check that the number of rows in land_use_taz matches the number of zones in the skims
network_los: Network_LOS = state.get("network_los")
skims = network_los.get_skim_dict("taz")
if isinstance(skims, SkimDict):
assert len(skims.zone_ids) == len(df)
else: # SkimDataset
assert len(skims.dataset.indexes["otaz"]) == len(df)

# replace table function with dataframe
state.add_table("land_use_taz", df)

Expand Down
10 changes: 10 additions & 0 deletions activitysim/core/los.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ def load_data(self):
else:
self.skim_dicts["tap"] = self.get_skim_dict("tap")

# check that the number of rows in land_use_taz matches the number of zones in the skims
# network_los: Network_LOS = state.get("network_los")
skims = self.get_skim_dict("taz")
if hasattr(skims, "zone_ids"): # SkimDict
assert len(skims.zone_ids) == len(self.state.get_dataframe("land_use_taz"))
else: # SkimDataset
assert len(skims.dataset.indexes["otaz"]) == len(
self.state.get_dataframe("land_use_taz")
)

def create_skim_dict(self, skim_tag, _override_offset_int=None):
"""
Create a new SkimDict of type specified by skim_tag (e.g. 'taz', 'maz' or 'tap')
Expand Down

0 comments on commit 8cc0a42

Please sign in to comment.