[Back to Interface] [Prev] [Next]


int32 SDcreate(int32 sd_id, char *name, int32 data_type, int32 rank, int32 dimsizes[])



SD interface identifier returned by SDstart



Name of the data set



Data type for the values in the data set



Number of the data set dimensions



Array containing the size of each dimension


Creates a new data set.

Return value

Returns the data set identifier (sds_id) if successful and FAIL (or -1) otherwise.


SDcreate creates a data set with the name specified by the parameter name, the values of the data type specified by parameter data_type, the number of dimensions specified by the parameter rank, and the dimension sizes specified by the array dimsizes.

Once a data set has been created, it is not possible to change its name, data type, or rank. However, it is possible to create a data set and close the file before writing any data values to it. The values can be added or modified at a future time. To add data or modify an existing data set, use SDselect to get the data set identifier instead of SDcreate.

If the parameter name is NULL in C or an empty string in Fortran, the default name "Data Set" will be generated. If the length of the name specified by the name parameter is longer than 64 characters, then the name will be truncated to 64 characters.

The calling program must ensure that the length of the dimsizes array is the value of the rank parameter, which is between 1 and MAX_VAR_DIMS (or 32).

To create a data set with unlimited dimensions, assign the value of SD_UNLIMITED (or 0) to the dimsizes[0] in C and to dimsizes[rank] in Fortran.

The data_type parameter can contain any data type supported by the HDF library. These data types are listed in Table 1A in Section I of this manual.


integer function sfcreate(sd_id, name, data_type, rank, dimsizes)

character*(*) name

integer sd_id, data_type, rank, dimsizes(*)

[Back to Interface] [Prev] [Next]

HDF Reference Manual - 04/08/98, NCSA HDF Development Group.