def get_travel_times(self, origin, destination): """ This method is used to get the travel times Input: Origin and destination arrays Output: Returns an array with travel times """ # Printing vertices #print 'origin - ', origin #print 'destination - ', destination #get the array length and initialize the tt array arr_len = origin.size tt = zeros(arr_len) #convert the arrays to carrays org_arr = self.numpy_to_carray(origin, arr_len, 0) dest_arr = self.numpy_to_carray(destination, arr_len, 0) tt_arr = self.numpy_to_carray(tt, arr_len, 1) #start retrieving travel times skimsquery.get_tt(org_arr, dest_arr, tt_arr, arr_len, self.offset) #conversion from carray to numpy new_tt = self.carray_to_numpy(tt_arr, arr_len, 1) #deleting all the carrays self.delete_carray(org_arr, 0) self.delete_carray(dest_arr, 0) self.delete_carray(tt_arr, 1) #return the travel times numpy array #print 'tt', new_tt return new_tt
def get_travel_times(self, origin, destination): #get the array length and initialize the tt array arr_len = origin.size tt = zeros(arr_len) #convert the arrays to carrays org_arr = self.numpy_to_carray(origin, arr_len, 0) dest_arr = self.numpy_to_carray(destination, arr_len, 0) tt_arr = self.numpy_to_carray(tt, arr_len, 1) #start retrieving travel times skimsquery.get_tt(org_arr, dest_arr, tt_arr, arr_len, self.offset) #conversion from carray to numpy new_tt = self.carray_to_numpy(tt_arr, arr_len, 1) #deleting all the carrays self.delete_carray(org_arr, 0) self.delete_carray(dest_arr, 0) self.delete_carray(tt_arr, 1) #return the travel times numpy array #print 'tt', new_tt return new_tt