def create_levels(ds, levels):
# Create a dataset in the LEVEL_GROUP
# and store as native numpy / h5py types
level_grp = ds.file.get(LEVEL_GROUP)
if level_grp is None:
# Create a LEVEL_GROUP
level_grp = ds.file.create_group(LEVEL_GROUP)
ds_name = ds.name.split("/")[-1]
dt = h5py.special_dtype(vlen=str)
level_grp.create_dataset(ds_name,
shape = [len(levels)],
maxshape = (None,),
dtype = dt,
data = levels,
compression = COMPRESSION,
chunks = (CHUNK_SIZE,))
评论列表
文章目录