def __test_concat_hdf(self, dest=None): ''' Tests that the dataset within the path matching 'series/<Param Name>/data' is concatenated, while other datasets and attributes are unaffected. ''' out_path = concat_hdf((self.hdf_path_1, self.hdf_path_2), dest=dest) if dest: self.assertEqual(dest, out_path) with h5py.File(out_path, 'r') as hdf_out_file: self.assertEqual(hdf_out_file.attrs['tailmark'], 'G-DEM') series = hdf_out_file['series'] self.assertEqual(series.attrs['frame_type'], '737-3C') param = series['PARAM'] self.assertEqual(param.attrs['frequency'], 8) data_result = param['data'][:] data_expected_result = np.concatenate((self.hdf_data_1, self.hdf_data_2)) # Cannot test numpy array equality with simply == operator. self.assertTrue(all(data_result == data_expected_result)) # Ensure 'other' dataset has not been concatenated. other_result = param['other'][:] other_expected_result = self.hdf_data_1 self.assertTrue(all(other_result == other_expected_result)) self.assertEqual(hdf_out_file.attrs['duration'], 50)
def __test_concat_hdf(self, dest=None): ''' Tests that the dataset within the path matching 'series/<Param Name>/data' is concatenated, while other datasets and attributes are unaffected. ''' out_path = concat_hdf((self.hdf_path_1, self.hdf_path_2), dest=dest) if dest: self.assertEqual(dest, out_path) with h5py.File(out_path, 'r') as hdf_out_file: self.assertEqual(hdf_out_file.attrs['tailmark'], 'G-DEM') series = hdf_out_file['series'] self.assertEqual(series.attrs['frame_type'], '737-3C') param = series['PARAM'] self.assertEqual(param.attrs['frequency'], 8) data_result = param['data'][:] data_expected_result = np.concatenate( (self.hdf_data_1, self.hdf_data_2)) # Cannot test numpy array equality with simply == operator. self.assertTrue(all(data_result == data_expected_result)) # Ensure 'other' dataset has not been concatenated. other_result = param['other'][:] other_expected_result = self.hdf_data_1 self.assertTrue(all(other_result == other_expected_result)) self.assertEqual(hdf_out_file.attrs['duration'], 50)
def join_files(first_part, second_part): """ Flight Joining """ hdf_path = concat_hdf([first_part, second_part], dest=first_part) return hdf_path