Skip to content

Instantly share code, notes, and snippets.

@chr5tphr
Created June 2, 2020 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chr5tphr/429b75fa07f46c3b3b9beb254c0e858f to your computer and use it in GitHub Desktop.
Save chr5tphr/429b75fa07f46c3b3b9beb254c0e858f to your computer and use it in GitHub Desktop.
import h5py
import click
@click.command()
@click.argument('sources', nargs=-1, type=click.Path(exists=True, dir_okay=False))
@click.argument('destination', type=click.Path(dir_okay=False, writable=True))
def main(sources, destination):
outfd = h5py.File(destination, 'a')
for src in sources:
with h5py.File(src, 'r') as srcfd:
for key in list(srcfd):
h5py.h5o.copy(srcfd.id, key.encode('ascii'), outfd.id, key.encode('ascii'))
outfd.close()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment