6.4.3CREATE GROUP
Syntax
CREATE [TRUNCATE] [AND USE] GROUP [file_name] group_name [, [file_name] group_name]*
[ORDER {TRACKED | INDEXED}]
[STORAGE COMPACT object_max_compact DENSE object_min_dense]
[ATTRIBUTE [ORDER {TRACKED | INDEXED}] [STORAGE COMPACT attribute_max_compact DENSE attribute_min_dense]]
Description
Create an HDF5 group named group_name. Multiple groups can be created at once by separating their names with a comma (,). If group_name already exists, it is not overwritten, no subsequent groups are created, and an error is raised. To overwrite an existing group, specify the keyword TRUNCATE (all data stored in the group will be permanently lost). In case the keyword AND USE is specified, the group is used (i.e. opened) after being successfully created (please refer to the operation USE GROUP for additional information). In case group_name includes intermediate groups that do not exist, they are created automatically along with group_name (e.g. when creating the group “my_group/my_subgroup/my_subsubgroup”, in addition to “my_subsubgroup” being created, “my_group” and “my_subgroup” are also created if they do not already exist). By default, group_name does not track objects (i.e. groups, datasets, (soft) links, and external links) stored within it by their creation order. To track the creation order of objects stored in group_name, the keyword ORDER TRACKED must be specified. In case the keyword ORDER INDEXED is specified, objects stored within group_name are also tracked by their creation order and using an index (to speed up retrieval of object names). By default, group_name does not track attributes stored within it by their creation order. To track the creation order of attributes stored in group_name, the keyword ATTRIBUTE ORDER TRACKED must be specified. In case the keyword ATTRIBUTE ORDER INDEXED is specified, attributes stored within group_name are also tracked by their creation order and using an index (to speed up retrieval of attribute names).
Parameter(s)
file_name – optional string that specifies the name of the HDF5 file in which the group is to be created. If file_name is specified, the file is opened on the fly, the group is created within it, and the file is subsequently closed. If not specified, the file currently in use is used instead. As a general rule, in case file_name contains spaces or special characters, it should be enclosed in double quotes (“). Otherwise, if it is not enclosed in double quotes, the group is not created, and an error is raised. This rule also applies to any other HDFql operation that works with file names (e.g. RENAME FILE).
group_name – mandatory string that specifies the name of the HDF5 group to create. As a general rule, in case group_name contains spaces or special characters, it should be enclosed in double quotes (“). Otherwise, if it is not enclosed in double quotes, the group is not created, and an error is raised. This rule also applies to any other HDFql operation that works with group names (e.g. RENAME GROUP).
object_max_compact – optional integer that specifies the maximum number of links (i.e. objects) to store in the compact format. In case the number of links (stored in group_name) exceeds object_max_compact, the storage of links switches to the dense format. If not specified, its default value is 8 (defined by the HDF5 library).
object_min_dense – optional integer that specifies the minimum number of links (i.e. objects) to store in the dense format. In case the number of links (stored in group_name) falls below object_min_dense, the storage of links switches to the compact format. If not specified, its default value is 6 (defined by the HDF5 library).
attribute_max_compact – optional integer that specifies the maximum number of attributes to store in the compact format. In case the number of attributes (stored in group_name) exceeds attribute_max_compact, the storage of attributes switches to the dense format. If not specified, its default value is 8 (defined by the HDF5 library).
attribute_min_dense – optional integer that specifies the minimum number of attributes to store in the dense format. In case the number of attributes (stored in group_name) falls below attribute_min_dense, the storage of attributes switches to the compact format. If not specified, its default value is 6 (defined by the HDF5 library).
Return
Nothing
Example(s)
# create an HDF5 group named "my_group0" (the group will not be overwritten if it already exists)
CREATE GROUP my_group0
# create an HDF5 group named "my_subgroup0" in a root group named "my_group1" (neither group will be overwritten if they already exist; group "my_group1" will be created automatically if it does not exist)
CREATE GROUP /my_group1/my_subgroup0
# create two HDF5 groups named "my_group2" and "my_group3" (both groups will be overwritten if they already exist)
CREATE TRUNCATE GROUP my_group2, my_group3
# create an HDF5 group named "this is a long group name" (the group will not be overwritten if it already exists) and use (i.e. open) it for subsequent operations
CREATE AND USE GROUP "this is a long group name"# create an HDF5 group named "my_group4" that tracks the objects’ (i.e. groups and datasets) creation order within the group and using compact storage
CREATE GROUP my_group4 ORDER TRACKED STORAGE COMPACT 10 DENSE 7
# create an HDF5 group named "my_group5" that indexes the creation order of attributes
CREATE GROUP my_group5 ATTRIBUTE ORDER INDEXED# use (i.e. open) an HDF5 file named "my_file.h5"
USE FILE my_file.h5
# create an HDF5 group named "my_group6" in the HDF5 file currently in use (i.e. file "my_file.h5")
CREATE GROUP my_group6
# close HDF5 file currently in use (i.e. file "my_file.h5")
CLOSE FILE
# create an HDF5 group named "my_group7" in file "my_file.h5"
CREATE GROUP my_file.h5 my_group7