ActivitySim / activitysim

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

Copying TAZ bike time matrix to output OMX failure #156

Closed wusun2 closed 7 years ago

wusun2 commented 7 years ago

import_data.py failed when copying TAZ bike time matrix to OMX output_taz_skims[]-line 169,

billyc commented 7 years ago

@wusun2 I recently pushed some changes to the Python OMX package on pip, this could be related.

Please give more detail on the error message -- there is no file named "import_data.py" file in the activitysim repo so I need more info to help out...

toliwaga commented 7 years ago

@billyc - it is in the multi-zone branch

wusun2 commented 7 years ago

@billyc Error message in import_data.py in multi-zone branch is attached below. The program attempts to add a bike time skim (converted from CSV) to an existing OMX already populated with highway skims. It complains the OMX object is not writeable.

impdan_PM.omx shape (4996, 4996) mappings ['Destination', 'Origin'] copying impdan_PM.omx SCST_PM to SOV_COST__PM copying impdan_PM.omx STM_PM (Skim) to SOV_TIMEPM impdan_AM.omx shape (4996, 4996) mappings ['Destination', 'Origin'] copying impdan_AM.omx *SCST_AM to SOV_COSTAM copying impdan_AM.omx *STM_AM (Skim) to SOV_TIME__AM Traceback (most recent call last): File "E:/apps/activitysim/example_multi/import_data.py", line 168, in output_taz_skims['bike_logsum'] = logsum File "C:\anaconda43\lib\site-packages\openmatrix\File.py", line 229, in setitem return self.create_matrix(key, atom, shape, obj=dataset) File "C:\anaconda43\lib\site-packages\openmatrix\File.py", line 30, in create_matrix if self.shape() is not None and obj is not None and obj.shape != self.shape(): File "C:\anaconda43\lib\site-packages\openmatrix\File.py", line 79, in shape if self._isWritable(): AttributeError: 'File' object has no attribute '_isWritable' Closing remaining open files:T:/ABM/ActivitySim/SANDAG_ActivitySim/project/output/taz_skims.omx...done

toliwaga commented 7 years ago

@billyc

you are probably using tables 3.3.0 and there is a camelCase call in the omx code that broke when they removed support for camelCase function names, replacing them with underscore_case

File.py line 79: _isWritable should probably be something like _is_writable

import_data.py works for me using pytables 3.2.3.1 (conda np111py27_0) but not with tables 3.3.0 (pip)

billyc commented 7 years ago

Found it -- looks like PyTables changed the capitalization of _isWritable to _iswritable in tables > 3.0. Activitysim must be pulling in the new version of tables, so it's breaking.

(see http://www.pytables.org/MIGRATING_TO_3.x.html

I'll fix this

billyc commented 7 years ago

Uploaded new version 0.3.3 of OMX to PyPi. Please upgrade and test, and let me know if this solves the problem

pip install --upgrade openmatrix

wusun2 commented 7 years ago

@billyc worked perfectly. Thanks.