Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

los.py expecting number of TAZs in land use to match length of skim index #837

Open
aletzdy opened this issue Mar 20, 2024 · 1 comment
Open

Comments

@aletzdy
Copy link
Contributor

aletzdy commented Mar 20, 2024

The current beta release of ActivitySim expects the length of TAZs in the land use data to match the length of skim indices. This can cause a crash if the skims include external stations, but the land use data only contains internal zones. This is the case with SEMCOG implementation and might be with other models too.

I am brining this up here so others be aware of it, and we can discuss it if needed.

@JilanChen

@i-am-sijia
Copy link
Contributor

The source code already provides a solution to this issue. See code snippet below. When the TAZs in the land use data mismatch the skims (which is reasonable as you said re: externals), Users can specify a land_use_taz table in the input_table_list in settings.yaml. The land_use_taz just need to have a TAZ column including all the TAZs in skims, increasing monotonically, see example here.

@workflow.table
def land_use_taz(state: workflow.State):
try:
df = read_input_table(state, "land_use_taz")
except MissingInputTableDefinition:
# if the land_use_taz table is not given explicitly in the settings,
# we will construct our best approximation of the table by collecting
# a sorted list of unique TAZ ids found in the land_use table of MAZs.
# In nearly all cases this should be good enough, unless the model
# includes TAZs without MAZs (e.g. external stations) or for some
# reason wants TAZs in some not-sorted ordering.
land_use = state.get_dataframe("land_use")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants