ActivitySim / activitysim

An Open Platform for Activity-Based Travel Modeling
https://activitysim.github.io
BSD 3-Clause "New" or "Revised" License
191 stars 99 forks source link

Skim offset hardwired to -1 #390

Closed mattwigway closed 5 days ago

mattwigway commented 3 years ago

On the develop2 branch, the skim offset is hardwired to -1 on Line 185 of skim_dictionary.py:

            # assume this is a one-based skim map
            offset_mapper.set_offset_int(-1)

This causes activitysim to fail when run with 0-based TAZ input data. Workaround for now is to add a mapping to the skims file that is just the output of np.arange(n_zones). This may be the issue underlying #388 as well.

toliwaga commented 3 years ago

Yes, activitysim assumes that any omx that has no mapentries (as returned by listMappings) has skim offset of -1.

We might consider allowing the skim offset to be specified in the netwoek_los.yaml config file - but this leads to a somewhat inelegant separation of the skim metadata from the skims themselves. And if we do support it, should this be a global setting, or might it differ from file to file.

In the meantime, you can simply add a mapentry array to your skims file. This should not result in a performance hit as activitysim will notice that there is a static offset and assign it (in your case 0) rather than using an offset_series.