HDFql Reference Manual v2.6.0

6.4.8ALTER DIMENSION

Syntax

ALTER DIMENSION [file_name] dataset_name [, [file_name] dataset_name]* TO {dataset_dim | {[dataset_dim] {, [dataset_dim]}+}}

Description

Alter (i.e. change) the dimensions of an existing HDF5 dataset named dataset_name. Multiple datasets can have their dimensions altered at once by separating their names with a comma (,). If dataset_name was not found or its dimensions could not be altered (due to its storage type not being HDFQL_CHUNKED or for unknown/unexpected reasons), no subsequent datasets are altered, and an error is raised.

Parameter(s)

file_name – optional string that specifies the name of the HDF5 file storing the dataset whose dimensions are to be altered (i.e. changed). If file_name is specified, the file is opened on the fly, the dimensions of the dataset are altered, and the file is subsequently closed. If not specified, the file currently in use is used instead.

dataset_name – mandatory string that specifies the name of the HDF5 dataset whose dimensions are to be altered (i.e. changed).

dataset_dim – mandatory integer that specifies the new size of the dimension in question. Depending on the prefix of the value specified in dataset_dim, one of the following behaviors applies:

  • If its prefix is “+”, the dimension will have its size increased by this value.
  • If its prefix is “-”, the dimension will have its size decreased by this value.
  • If its prefix is neither “+” nor “-”, the dimension will have exactly the size of this value.

To preserve the size of a certain dimension (i.e. to prevent its size from being altered), it should be skipped by specifying a comma (,).

Return

Nothing

Example(s)

# create an HDF5 dataset named "my_dataset" of data type double of three dimensions (first dimension with size 2 and extendible up to 10; second dimension with size 7; third dimension with size 20 and extendible to an unlimited size)
CREATE CHUNKED DATASET my_dataset AS DOUBLE(2 TO 10, 7, 20 TO UNLIMITED)

# show (i.e. get) current dimensions of dataset "my_dataset" (should return 2, 7, 20) 
SHOW DIMENSION my_dataset

# alter (i.e. change) dimensions of dataset "my_dataset" to set the size of its first dimension to 6 and increase the size of its third dimension by 10 (the size of the second dimension remains intact)
ALTER DIMENSION my_dataset TO 6, , +10

# show (i.e. get) current dimensions of dataset "my_dataset" (should return 6, 7, 30) 
SHOW DIMENSION my_dataset

# alter (i.e. change) dimensions of dataset "my_dataset" to increase the size of its first dimension by 2, set the size of its second dimension to 3, and decrease the size of its third dimension by 5
ALTER DIMENSION my_dataset TO +2, 3, -5

# show (i.e. get) current dimensions of dataset "my_dataset" (should return 8, 3, 25) 
SHOW DIMENSION my_dataset