Replaced commented lines by accurate comments
This commit is contained in:
@ -410,20 +410,7 @@ def create_hdf5_file_from_filesystem_path(output_filename : str,
|
|||||||
try:
|
try:
|
||||||
# Create group and add their attributes
|
# Create group and add their attributes
|
||||||
h5file[group_name].create_group(name=file_dict['name'])
|
h5file[group_name].create_group(name=file_dict['name'])
|
||||||
#for key in file_dict['attributes_dict'].keys():
|
# Add group attributes
|
||||||
|
|
||||||
# Represent string values as fixed length strings in the HDF5 file, which need
|
|
||||||
# to be decoded as string when we read them. It provides better control than variable strings,
|
|
||||||
# at the expense of flexibility.
|
|
||||||
# https://docs.h5py.org/en/stable/strings.html
|
|
||||||
# value = file_dict['attributes_dict'][key]
|
|
||||||
# if isinstance(value,str):
|
|
||||||
# utf8_type = h5py.string_dtype('utf-8', len(value))
|
|
||||||
# value = np.array(value.encode('utf-8'),dtype=utf8_type)
|
|
||||||
|
|
||||||
# h5file[group_name][file_dict['name']].attrs.create(name=key,
|
|
||||||
# data=value)
|
|
||||||
|
|
||||||
h5file[group_name][file_dict['name']].attrs.update(file_dict['attributes_dict'])
|
h5file[group_name][file_dict['name']].attrs.update(file_dict['attributes_dict'])
|
||||||
|
|
||||||
# Add datasets to just created group
|
# Add datasets to just created group
|
||||||
@ -432,9 +419,8 @@ def create_hdf5_file_from_filesystem_path(output_filename : str,
|
|||||||
data = dataset['data'],
|
data = dataset['data'],
|
||||||
#dtype = file_dict['dtype'],
|
#dtype = file_dict['dtype'],
|
||||||
shape = dataset['shape'])
|
shape = dataset['shape'])
|
||||||
# Add dataset's attributes
|
|
||||||
#for attr_key in dataset.get('attributes',{}).keys():
|
# Add dataset's attributes
|
||||||
# h5file[group_name][file_dict['name']][dataset['name']].attrs[attr_key] = dataset.get('attributes',{})[attr_key]
|
|
||||||
attributes = dataset.get('attributes', {})
|
attributes = dataset.get('attributes', {})
|
||||||
h5file[group_name][file_dict['name']][dataset['name']].attrs.update(attributes)
|
h5file[group_name][file_dict['name']][dataset['name']].attrs.update(attributes)
|
||||||
except Exception as inst:
|
except Exception as inst:
|
||||||
|
Reference in New Issue
Block a user