1'''Virtual datasets: The 'Dual PCO Edge' use case 2 3https://support.hdfgroup.org/HDF5/docNewFeatures/VDS/HDF5-VDS-requirements-use-cases-2014-12-10.pdf 4''' 5 6import h5py 7 8with h5py.File('raw_file_1.h5', 'r') as f: 9 in_sh = f['data'].shape # get the input shape 10 dtype = f['data'].dtype # get the datatype 11 12gap = 10 13 14# Sources represent the input datasets 15vsource1 = h5py.VirtualSource('raw_file_1.h5', 'data', shape=in_sh) 16vsource2 = h5py.VirtualSource('raw_file_2.h5', 'data', shape=in_sh) 17# target is where we layout the virtual dataset 18layout = h5py.VirtualLayout((in_sh[0], 2 * in_sh[1] + gap, in_sh[3]), 19 dtype=dtype) 20layout[0:in_sh[0]:1, :, :] = vsource1 21layout[(in_sh[0] + gap):(2 * in_sh[0] + gap + 1):1, :, :] = vsource2 22 23# Create an output file 24with h5py.File('outfile.h5', 'w', libver='latest') as f: 25 f.create_virtual_dataset('data', layout, fillvalue=0x1) 26