one_64_ris_hdf.f

      program one_64_ris_hdf
      character*1 image(64,64)
      character*1 colors(768) 
      integer ivals(64,64,62)
      integer DFR8setpalette,DFR8putimage,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=20
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,iz))
  100 continue
c
c  write image to an HDF file
c
      ret=DFR8putimage('one_64_ris.hdf', image, 64, 64, 0)
c
      if (istat .ne. 0)then
	 write(*,*)'Error Writing HDF File'
      endif
c  
  888 stop
      end