Skip to content

Commit

Permalink
add check that land_use_taz matches skims
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Jul 14, 2023
1 parent c27fae6 commit c5ea52c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions activitysim/abm/tables/landuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from activitysim.core import workflow
from activitysim.core.exceptions import MissingInputTableDefinition
from activitysim.core.input import read_input_table
from activitysim.core.los import Network_LOS
from activitysim.core.skim_dictionary import SkimDict

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -79,6 +81,14 @@ 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

0 comments on commit c5ea52c

Please sign in to comment.