To read data from an SDS array, the calling program must contain the following function calls:
C: sds_id = SDselect(sd_id, sds_index);
status = SDreaddata(sds_id, start, stride, edges, data);
FORTRAN: sds_id = sfselect(sd_id, sds_index)
status = sfrdata(sds_id, start, stride, edges, data)
OR status = sfrcdata(sds_id, start, stride, edges, data)
Note that step 2 is not illustrated in the function call syntax; it is carried out by assigning values to the parameters start
, stride
, and edges
before the routine SDreaddata is called in step 3.start
, stride
, and edges
and stores the data into the buffer provided, data
. The argument sds_id
is the SDS identifier returned by SDcreate or SDselect. As with SDwritedata, the arguments start
, stride
, and edges
describe the starting location, the number of elements to skip after each read, and the number of elements to be read, respectively, for each dimension. For additional information on the parameters start
, stride
, and edges
, refer to Section 3.5.1 on page 28.
There are two FORTRAN-77 versions of this routine: sfrdata reads numeric data and sfrcdata reads character data.
SUCCEED
(or 0
), including the situation when the data set does not contain data, or FAIL
(or -1
). The parameters of SDreaddata are further described in Table 3K.
TABLE 3K - SDreaddata Parameter List
C version
EXAMPLE 9. Reading Subsets of an SDS.
This example shows how parameters start
, stride
, and edges
of the routine SDreadata/sfrdata can be used to read three subsets of an SDS array.