Skip to content

location choice model alt preprocessor is not working as intended #971

Description

@bwentl

Describe the bug
We are trying to set up alternative preprocessor for workplace location to better support calculations done in our model, but we found a typo in run_location_simulate. run_location_simulate is currently using alts_preprocessor_sample as the preprocessor_setting_name:

expressions.annotate_preprocessors(
state,
df=alternatives,
locals_dict=locals_d,
skims=None,
model_settings=model_settings,
trace_label=trace_label,
preprocessor_setting_name="alts_preprocessor_sample",
)

I believe this is a typo, because there should be a separate preprocessor setting for simulate, usually we would name them alts_preprocessor.

To Reproduce
Steps to reproduce the behavior:

  1. Set up workplace location model with alternative preprocessing by adding the following into workplace_location.yaml
preprocessor:
  SPEC: workplace_location_preprocessor
  DF: choosers
  TABLES:
    - land_use

alts_preprocessor_sample:
  SPEC: workplace_location_alts_preprocessor_sample
  DF: alts
  TABLES:
    - land_use

alts_preprocessor_simulate:
  SPEC: workplace_location_alts_preprocessor
  DF: alts
  TABLES:
    - land_use
  1. Create workplace_location_alts_preprocessor.csv like so (example column names for land use would be specific for your dataset):
Description,Target,Expression
alt_dest_seedgeo,alt_dest_seedgeo,"reindex(land_use.gk_ensem, df.alt_dest)"
  1. Create workplace_location_alts_preprocessor_sample.csv like so:
Description,Target,Expression
alt_dest_seedgeo,alt_dest_seedgeo,"reindex(land_use.gk_ensem, df.index)"

Expected behavior with Screenshots
When running the model, we would expect the reindex function to look up based on alternative destination zone id to get the gk_ensem in our land_use file, but we see NAs in trace file from location choice simulate:

Image

The same problem does not happen for location choice sample (this is what we want to see in simulate also:

Image

Additional context
We are trying to add alternative preprocessors into workplace location with re_index function so we can use sharrow for workplace location model.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working/bug f

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions