[Top] [Prev] [Next]

3.3 The SD Interface

The SD interface provides routines that store, retrieve, and manipulate scientific data using the SDS data model. The SD interface supports simultaneous access to more than one SDS in more than one HDF file. In addition, the SD interface is designed to support a general scientific data model which is very similar to the netCDF data model developed by the Unidata Program Center1.

For those users who have been using the DFSD interface, the SD interface provide a model compatible with that supported by the DFSD interface. It is recommended that DFSD users apply the SD model and interface to their applications since the DFSD interface is less flexible and less powerful than the SD interface and will eventually be removed from the HDF library.

This section specifies the header file to be used with the SD interface and lists all available SD interface routines, each of which is accompanied by its purpose and the section where the routine is discussed.

3.3.1 Header and Include Files Used by the SD Interface

The "mfhdf.h" header file must be included in programs that invoke SD interface routines. FORTRAN-77 users should refer to Section 2.5.3 on page 16.

3.3.2 SD Interface Routines

All C routines in the SD interface begin with the prefix "SD". The equivalent FORTRAN-77 routines use the prefix "sf". These routines are categorized as follows:

The SD routines are listed in the following table and are discussed in the following sections of this document.

TABLE 3A - SD Interface Routines

Category
Routine Name
Description and Reference
C
FORTRAN-77
Access
SDstart sfstart Opens the HDF file and initializes the SD interface (Section 3.4.1 on page 25)

SDcreate sfcreate Creates a new data set (Section 3.4.1 on page 25)

SDselect sfselect Selects an existing SDS using its index (Section 3.4.1 on page 25)

SDendaccess sfendacc Terminates access to an SDS (Section 3.4.2 on page 27)

SDend sfend Terminates access to the SD interface and closes the file (Section 3.4.2 on page 27)

Read and Write
SDreaddata sfrdata/ sfrcdata Reads data from a data set (Section 3.6 on page 37)

SDwritedata sfwdata/ sfwcdata Writes data to a data set (Section 3.5.1 on page 28)

General Inquiry
SDfileinfo sffinfo Retrieves information about the contents of a file (Section 3.7.1 on page 39)

SDgetinfo sfginfo Retrieves information about a data set (Section 3.7.2 on page 40)

SDcheckempty sfchempty Determines whether a scientific dataset (an SDS) is empty (Section 3.7.3 on page 40)

SDidtoref sfid2ref Returns the reference number of a data set (Section 3.7.6 on page 42)

SDiscoordvar sfiscvar Distinguishes data sets from dimension scales (Section 3.8.4.4 on page 48)

SDisrecord sfisrcrd Determines whether a data set is appendable (Section 3.5.1.4 on page 31)

SDnametoindex sfn2index Returns the index of a data set specified by its name (Section 3.7.4 on page 41)

SDreftoindex sfref2index Returns the index of a data set specified by its reference number (Section 3.7.5 on page 41)

Dimensions
SDdiminfo sfgdinfo Gets information about a dimension (Section 3.8.4.2 on page 47)

SDgetdimid sfdimid Returns the identifier of a dimension (Section 3.8.1 on page 44)

SDsetdimname sfsdimname Associates a name with a dimension (Section 3.8.2 on page 44)

Dimension Scales
SDgetdimscale sfgdscale Retrieves the scale values for a dimension (Section 3.8.4.3 on page 47)

SDsetdimscale sfsdscale Stores the scale values of a dimension (Section 3.8.4.1 on page 46)

User-defined Attributes
SDattrinfo sfgainfo Gets information about an attribute (Section 3.9.2 on page 51)

SDfindattr sffattr Returns the index of an attribute specified by its name (Section 3.9.2 on page 51)

SDreadattr sfrnatt/sfrcatt Reads the values of an attribute specified by its index (Section 3.9.3 on page 52)

SDsetattr sfsnatt/sfscatt Creates a new attribute and stores its values (Section 3.9.1 on page 51)

Predefined Attributes
SDgetcal sfgcal Retrieves calibration information (Section 3.10.6.2 on page 61)

SDgetdatastrs sfgdtstr Returns the predefined-attribute strings of a data set (Section 3.10.2.2 on page 56)

SDgetdimstrs sfgdmstr Returns the predefined-attribute strings of a dimension (Section 3.10.3.2 on page 57)

SDgetfillvalue sfgfill/sfgcfill Reads the fill value if it exists (Section 3.10.5.2 on page 60)

SDgetrange sfgrange Retrieves the range of values in the specified data set (Section 3.10.4.2 on page 58)

SDsetcal sfscal Defines the calibration information (Section 3.10.6.1 on page 61)

SDsetdatastrs sfsdtstr Sets predefined attributes of the specified data set (Section 3.10.2.1 on page 56)

SDsetdimstrs sfsdmstr Sets predefined attributes of the specified dimension (Section 3.10.3.1 on page 57)

SDsetfillvalue sfsfill/sfscfill Defines the fill value for the specified data set (Section 3.10.5.1 on page 60)

SDsetfillmode sfsflmd Sets the fill mode to be applied to all data sets in the specified file (Section 3.10.5.3 on page 60)

SDsetrange sfsrange Defines the maximum and minimum values of the specified data set (Section 3.10.4.1 on page 58)

Compression
SDsetcompress sfscompress Compresses a data set using a specified compression method (Section 3.5.2 on page 32)

SDsetnbitdataset sfsnbit Defines the non-standard bit length of the data set data (Section 3.7.7 on page 42)

Chunking/
Tiling
SDgetchunkinfo sfgichnk Obtains information about a chunked data set (Section 3.11.5 on page 68)

SDreadchunk sfrchnk/sfrcchnk Reads data from a chunked data set (Section 3.11.4 on page 67)

SDsetchunk sfschnk Makes a non-chunked data set a chunked data set (Section 3.11.1 on page 63)

SDsetchunkcache sfcchnk Sets the size of the chunk cache (Section 3.11.2 on page 65)

SDwritechunk sfwchnk/sfwcchnk Writes data to a chunked data set (Section 3.11.3 on page 66)

Miscellaneous
SDsetblocksize sfsblsz Sets the block size used for storing data sets with unlimited dimension (Section 3.5.1.5 on page 32)

SDsetexternalfile sfsextf Specifies that a data set is to be stored in an external file (Section 3.5.3.3 on page 36)

SDisdimval_bwcomp sfisdmvc Determines the current compatibility mode of a dimension (Section 3.8.3.2 on page 46)

SDsetdimval_comp sfsdmvc Sets the future compatibility mode of a dimension (Section 3.8.3.1 on page 45)

3.3.3 Tags in the SD Interface

A complete list of SDS tags and their descriptions appears in Table D in Appendix A. Refer to Section 2.2.2.1 on page 8 for a description of tags.



[Top] [Prev] [Next]

1 netCDF-3 User's Guide for C (June 5, 1997), Section 2, http://www.unidata.ucar.edu/packages/netcdf/guidec/.

hdfhelp@ncsa.uiuc.edu
HDF User's Guide - 05/19/99, NCSA HDF Development Group.