Skip to content

Commit

Permalink
landuse index sort before sharrow recode check
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensle committed May 20, 2024
1 parent f1ee710 commit 96d4bb6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions activitysim/abm/tables/landuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
def land_use(state: workflow.State):
df = read_input_table(state, "land_use")

# try to make life easy for everybody by keeping everything in canonical order
# but as long as coalesce_pipeline doesn't sort tables it coalesces, it might not stay in order
# so even though we do this, anyone downstream who depends on it, should look out for themselves...
if not df.index.is_monotonic_increasing:
logger.info(f"sorting land_use index")
df = df.sort_index()

sharrow_enabled = state.settings.sharrow
if sharrow_enabled:
err_msg = (
Expand All @@ -34,12 +41,6 @@ def land_use(state: workflow.State):
assert df.index[-1] == len(df.index) - 1, err_msg
assert df.index.dtype.kind == "i", err_msg

# try to make life easy for everybody by keeping everything in canonical order
# but as long as coalesce_pipeline doesn't sort tables it coalesces, it might not stay in order
# so even though we do this, anyone downstream who depends on it, should look out for themselves...
if not df.index.is_monotonic_increasing:
df = df.sort_index()

logger.info("loaded land_use %s" % (df.shape,))
buffer = io.StringIO()
df.info(buf=buffer)
Expand Down

0 comments on commit 96d4bb6

Please sign in to comment.