many_64_ris_hdf.f
program many_64_ris_hdf
character*1 image(64,64)
character*1 colors(768)
integer ivals(64,64,62)
integer DFR8setpalette,DFR8putimage,DFR8addimage,ret
c
open(5,file='fan_64.ascii',status='old',err=888)
c
ret=DFR8setpalette(colors)
c
c read in integer values from input file
c
ix=64
iy=64
iz=62
c
read(5,10)(((ivals(i,j,k),i=1,ix),j=1,iy),k=1,iz)
10 format(20(1x,i3))
c
c convert first slice to character (8-bit) data
c
do 100 j=1,iy
do 100 i=1,ix
image(i,j)=char(ivals(i,j,1))
100 continue
c
c write image to an HDF file
c
ret=DFR8putimage('many_64_ris.hdf', image, 64, 64, 0)
c
c convert values in array ivals to character (8-bit) data
c
do 300 k=2,iz
do 200 j=1,iy
do 200 i=1,ix
image(i,j)=char(ivals(i,j,k))
200 continue
c
c write image to an HDF file
c
ret=DFR8addimage('many_64_ris.hdf', image, 64, 64, 0)
300 continue
c
if (istat .ne. 0)then
write(*,*)'Error Writing HDF File'
endif
c
888 stop
end