Created
December 5, 2017 12:18
-
-
Save Pseudomanifold/d6d00b2c9be9a8a0c3e770be4f1cbfb7 to your computer and use it in GitHub Desktop.
Creating a simple HDF5 test file with a single group and a single simple data set using the `h5py` Python bindings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Creates a simple 3x3 HDF5 test file. The file will contain | |
# a single group and a single *simple* data set. The numbers | |
# from 1 to 9 will be distributed over the data. | |
import h5py | |
f = h5py.File("Simple.hdf5", "w") | |
d = f.create_dataset("Simple", (3,3), dtype='f') | |
d[0,0] = 1 | |
d[0,1] = 2 | |
d[0,2] = 3 | |
d[1,0] = 4 | |
d[1,1] = 5 | |
d[1,2] = 6 | |
d[2,0] = 7 | |
d[2,1] = 8 | |
d[2,2] = 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment