To read an SDS of known dimension and number type, the calling program should include the following routine:
C: status = DFSDgetdata(filename, rank, dim_sizes, data);
FORTRAN: status = dsgdata(filename, rank, dim_sizes, data)DFSDgetdata has four parameters:
filename
, rank
, dim_sizes
, and data
. DFSDgetdata returns a data set specified by the parameter filename
. The total number of dimensions is specified in rank
and the size of each dimension is specified in dim_sizes.
DFSDgetdata returns the array in data
.The parameters of DFSDgetdata are further defined in the following table.
To determine the dimensions and data type of an array before attempting to read it, the calling program must include the following:
C: status = DFSDgetdims(filename, rank, dimsizes, max_rank);
status = DFSDgetNT(number_type);
status = DFSDgetdata(filename, rank, dimsizes, data);
FORTRAN: status = dsgnt(filename, rank, dimsizes, max_rank)
status = dsgdims(number_type)
status = dsgdata(filename, rank, dimsizes, data)DFSDgetdims has four parameters:
filename
, rank
, dim_sizes
, and maxrank
. The number of dimensions is returned in rank
, the size of each dimension in the array dim_sizes
, and the size of the array containing the dimensions sizes in max_rank
. DFSDgetNT has only one parameter: number_type
. As there is no way to specify the file or data set through the use of DFSDgetNT, it is only valid if it is called after DFSDgetdims. The parameters of DFSDgetdims and DFSDgetNT are further defined in the following table.
C: num_of_datasets = DFSDndatasets(filename);
FORTRAN: num_of_datasets = dsnum(filename)Once the total number of data sets is known, a calling program can at any time, reset the current data set to the first data set in the file by calling the following routine:
C: status = DFSDrestart( );
FORTRAN: status = dsfirst( )Use of DFSDndatasets and DFSDrestart is optional, it is usually more convenient than cycling through the entire file one SDS at a time.
The DFSD interface uses the function DFSDreadref to initiate access to individual scientific data sets. DFSDreadref specifies the reference number of the next SDS to be read.
To access a specific SDS, the calling program must contain the following routines:
C: status = DFSDreadref(filename, ref);
status = DFSDgetdata(filename, rank, dim_sizes, data);
FORTRAN: status = dsrref(filename, ref)
status = dsgdata(filename, rank, dim_sizes, data)DFSDreadref has two parameters:
filename
and ref
. DFSDreadref specifies the reference number of the object to be next operated on in the HDF file filename
as ref
. Determining the correct reference number is the most difficult part of this operation. As a result, DFSDreadref is often used in conjunction with DFSDlastref, which determines the reference number of the last data set accessed.To syntax of DFSDadddata and DFSDlastref is:
C: status = DFSDadddata(filename, rank, dim_sizes, data);
ref_num = DFSDlastref( );
FORTRAN: status = dsadata(filename, rank, dim_sizes, data)
ref_num = dslref( )DFSDputdata can also be used with DFSDlastref to obtain similar results. In any case, DFSDlastref can be used before any operation that requires identifying a scientific data set by reference number, as in the assignment of annotations and inserting data sets into vgroups. For more information about annotations and vgroups refer to Chapter 10, Annotations (AN API), and Chapter 5, Vgroups (V API).