Ejemplo n.º 1
0
def make_hdf5(name, shape=(50, 99, 101)):
    if h5py is None:
        raise unittest.SkipTest("h5py is not available")

    with h5py.File(name, mode="w") as h:
        e = h.require_group("entry")
        if len(shape) == 2:
            e.require_dataset("data", shape, compression="gzip", compression_opts=9, dtype="float32")
        elif len(shape) == 3:
            e.require_dataset("data", shape, chunks=(1,) + shape[1:], compression="gzip", compression_opts=9, dtype="float32")
    return name + "::entry/data"
Ejemplo n.º 2
0
def make_hdf5(name, shape=(50, 99, 101)):
    with h5py.File(name) as h:
        e = h.require_group("entry")
        if len(shape) == 2:
            e.require_dataset("data",
                              shape,
                              compression="gzip",
                              compression_opts=9,
                              dtype="float32")
        elif len(shape) == 3:
            e.require_dataset("data",
                              shape,
                              chunks=(1, ) + shape[1:],
                              compression="gzip",
                              compression_opts=9,
                              dtype="float32")
    return name + "::entry/data"