From 8cc0a420189ad09ccd62e20061faebcf76fd7bb9 Mon Sep 17 00:00:00 2001 From: Jeff Newman Date: Mon, 24 Jul 2023 17:51:07 -0500 Subject: [PATCH] move land_use_taz check --- activitysim/abm/tables/landuse.py | 8 -------- activitysim/core/los.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/activitysim/abm/tables/landuse.py b/activitysim/abm/tables/landuse.py index 91dd3e5ff..8d9376b75 100644 --- a/activitysim/abm/tables/landuse.py +++ b/activitysim/abm/tables/landuse.py @@ -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) diff --git a/activitysim/core/los.py b/activitysim/core/los.py index a22656298..d34f3c3b1 100644 --- a/activitysim/core/los.py +++ b/activitysim/core/los.py @@ -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')