[Back to Interface] [Prev] [Next]

SDcreate/sfcreate

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

sd_id IN:

SD interface identifier returned by SDstart

name IN:

Name of the data set

data_type IN:

Data type for the values in the data set

rank IN:

Number of the data set dimensions

dimsizes IN:

Array containing the size of each dimension

Purpose

Creates a new data set.

Return value

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

Description

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 an unlimited dimension, assign the value of SD_UNLIMITED (or 0) to 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.

FORTRAN

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

character*(*) name

integer sd_id, data_type, rank, dimsizes(*)



[Back to Interface] [Prev] [Next]

hdfhelp@ncsa.uiuc.edu
HDF Reference Manual - 07/29/98, NCSA HDF Development Group.