示例#1
0
 def get_travel_data_from_emme4(self, zone_set, path, matrix_variable_map, **kwargs):
     """Create a new travel_data from the emme4 output.
     Include the matrices listed in matrix_variable_map, which is a dictionary
     mapping the emme matrix name, e.g. au1tim, to the Opus variable
     name, e.g. single_vehicle_to_work_travel_time, as in:
     {"au1tim":"single_vehicle_to_work_travel_time"}
     """
     from psrc_parcel.emme.travel_model_output import TravelModelOutput
     tm_output = TravelModelOutput(self.emme_cmd)
     dstorage = StorageFactory().get_storage('dict_storage')
     data = {}
     for matrix_name in matrix_variable_map.keys():
         d[matrix_name] = open_emmbank_matrix_in_numpy(path, matrix_name)
     table_name = 'skims'
     dstorage.write_table(table_name = table_name, table_data = data)
     return tm_output.get_travel_data_set(zone_set, matrix_variable_map, in_storage=dstorage, 
                                          table_name=table_name, **kwargs)
示例#2
0
    def get_travel_data_from_emme4(self, zone_set, path, matrix_variable_map, bank_file=None, **kwargs):
        """Return a dataset travel_data with set of attributes from one bank.
        
        Creates an hdf5g storage with data corresponding to one bank in 
        matrix_variable_map. It calls the method get_travel_data_set from 
        psrc_parcel.emme.travel_model_output which is expected to return a travel_data 
        dataset with the set of attributes stored in the hdf5g storage.

        Arguments:
        zone_set -- dataset of zones
        path -- group name in the hdf5 file (i.e. the bank name, e.g. skims.auto.am)
        matrix_variable_map -- dictionary of skim names and corresponding attribute names
        bank_file -- full name of the hdf5 file        
        """
        from psrc_parcel.emme.travel_model_output import TravelModelOutput
        tm_output = TravelModelOutput(self.emme_cmd)
        h5storage = StorageFactory().get_storage('hdf5g_storage', 
                                                 storage_location=bank_file)
        return tm_output.get_travel_data_set(zone_set, matrix_variable_map,
                                             table_name=path, in_storage=h5storage, **kwargs)