Unlimited Dimension
Contents:
To make an SDS array appendable, one dimension must be specified
as unlimited when the array is created.
Following is how you would do this:
C:
The first parameter (dim[0]) is assigned the value SD_UNLIMITED.
FORTRAN:
The last parameter or dimension of the highest rank value
(dim(rank)) is assigned the value SD_UNLIMITED.
For example, if you took an example similar to the create example in the
last section, and made it appendable, it might look as follows
(this example also shows how to append data to the appendable array).
You can either download the C or FORTRAN
program at the end, or just take a look at the HTML version, with the
HDF calls highlighted:
If you have downloaded this program, then you can
compile and run it. It creates an HDF file
called sdunl.hdf.
You can view the contents of the HDF file created, using the
hdp command,
hdp dumpsds sdunl.hdf
File name: sdunl.hdf
Variable Name = data1
Index = 0
Type= 16-bit signed integer
Ref. = 2
Rank = 2
Number of attributes = 0
Dim0: Name=fakeDim0
Size = UNLIMITED (currently 11)
Type = number-type not set
Number of attributes = 0
Dim1: Name=fakeDim1
Size = 5
Type = number-type not set
Number of attributes = 0
Data :
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9
6 7 8 9 10
7 8 9 10 11
8 9 10 11 12
9 10 11 12 13
10 11 12 13 14
1 2 3 4 5
If we had not appended data to this file, the Unlimited Dimension size would
be 10, rather than 11, and the last line ("1 2 3 4 5") would not be there.
Programs used in this tutorial:
[Compiling a program]