HDF5 utilities

  1. Write a Python script that does each of the following:

    • Show the path for every group and dataset in an Hdf5 file. Use the h5py module.
    • Modify the above function so that it accumulates and returns a list of the names and the values (objects, that is, the groups and datasets) of each of the objects in an Hdf5 file.
    • Use the above function to accumulate a list of all the objects in an Hdf5 file and then to show (print out) information about a group or dataset from an Hdf5 file, given the path to that object. For a group, show the path; for a dataset, show the path, the data type (dtype), and the shape.

    What you will learn:

    • How to use the h5py module to extract data from an Hdf5 file.
  2. Write a function that takes a file name and a dataset name (path), and exports that dataset from the Hdf5 file to a CSV (comma separated values) file. Use the h5py and csv modules.

    What you will learn:

    • How to use the csv module to create a CSV file.
  3. Write a Python script that creates an Hdf5 file and populates it with some sample groups and datasets. You can hard code some sample data in your script, or, alternatively you can read your data from a separate data file (for example, a CSV file). Use the h5py module.

    What you will learn:

    • How to construct an Hdf5 archive and the groups and datasets in it using h5py.