* Program windows    							*
* This program writes out a 4D array in hdf format. 			*
* dimsizes={7,5,4,2} defines the dimension sizes of the output array.  *
* windims={7,5,1,1} defines the dimension sizes of the slice (window).  *
* dims={8,6,1,1} defines the dimension sizes of the input data array.   *
* dims may be larger than windims. In this case, that actual data may	*
* not be  contiguous in the input data array.				*
* The four dimentions may represent width=7, height=5, depth=4 and      *
* time=2.								* 

	integer rank
	integer i, j, ret
	integer dimsizes(4),dims(4), windims(4)
	real data(8,6,1,1)

	
C       initialization	

	rank=4
	
	dimsizes(1) = 7
	dimsizes(2) = 5
	dimsizes(3) = 4
	dimsizes(4) = 2

	dims(1) = 8
	dims(2) = 6
	dims(3) = 1
	dims(4) = 1

	windims(1) = 7
	windims(2) = 5
	windims(3) = 1
	windims(4) = 1
 
        do 130 j=1,dims(2)
	   do 120 i=1,dims(1)
	      data(i,j,1,1)=10.0*i+1.0*j
120        end do
130     end do

	ret=DFSDsetdims(rank, dimsizes)
	if (ret .NE. 0)	write(*,*) 'Error in set dimsizes'

	ret = DFSDstartslice('windtest.hdf')
	if (ret .NE. 0)	write(*,*) 'Error in startslice.'

	do 250 i=1,dimsizes(4)
	    do 200 j=1,dimsizes(3)	
		ret = DFSDputslice(windims,data,dims)
		if (ret .NE. 0)	write(*,*) 'Error in putslice', i,j
200         end do
250     end do


	write(*,*) 'Calling DFSDendslice'
	ret = DFSDendslice()
	if (ret .NE. 0)	write(*,*) 'Error in calling endslice'
	
	stop
	end


