

To begin this tutorial, examine the following FORTRAN code, code1.f, that uses the
HDF library to write a Scientific Data Set (SDS).
program code1
parameter(N1=50,N2=50,N3=50)
dimension u(N1,N2,N3)
c the integer array shape specifies a two dimensional array
c DFSDsetdims is an HDF library routine for setting dimensions
c of the scientific data set to be written
c DFSDputdata is an HDF library routine for writing an array as a
c scientific data set
integer shape(3), DFSDsetdims, DFSDputdata
character fn*10
shape(1) = N1
shape(2) = N2
shape(3) = N3
fn = 'code1.sds'
xk = 0.
do 1 k = 1,N3
xk = xk + 1.0
xj = 0.
do 1 j = 1,N2
xj = xj + 1.0
xi = 0.
do 1 i = 1,N1
xi = xi + 1.0
u(i,j,k) = (xi*xi+xj*xj+xk*xk-xi*xj-xj*xk)-25.*(xi+xk)
1 continue
iret = DFSDsetdims( 3, shape )
if(iret.ne.0) write(6,*) 'return code dims was `, iret
iret = DFSDputdata( fn, 3, shape, u )
if(iret.ne.0) write(6,*) 'return code put was `, iret
end
For full explanations of the calls to the HDF library, consult the HDF
documentation, also available via anonymous ftp from
To execute this code, check with your system administrator to verify that the HDF
library has been installed. Then proceed with:
and then, after compilation, execute Code 1 by entering
