-
Notifications
You must be signed in to change notification settings - Fork 118
Description
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:
activitysim/activitysim/abm/models/location_choice.py
Lines 699 to 707 in e345f97
| 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:
- 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- Create
workplace_location_alts_preprocessor.csvlike 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)"
- Create
workplace_location_alts_preprocessor_sample.csvlike 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:
The same problem does not happen for location choice sample (this is what we want to see in simulate also:
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.