c CBAR
c
c To make a remapp color-bar scale.
c
c  Lin Cordell 7 October 92
c
      character*50 ofile
      dimension id(14),pgm(2),g(2000)
1     format(' *',$)
800   format(a)
      print*,'Enter output grid file name:'
      print 1
      read(5,800)ofile
      print*,'Enter ncol,nrow:'
      print 1
      read*,ncol,nrow
      x0=0.
      y0=0.
      dx=1.
      dy=1.
      nz=1
      open(10,file=ofile,form='unformatted',status='new')
      print*,'Enter id:'
      print 1
      read(5,4)(id(i),i=1,14)
4     format(14a4)
      pgm(1)='colo'
      pgm(2)='r   '
      write(10)id,pgm,ncol,nrow,nz,x0,dx,y0,dy
      rnrow=nrow
      f=255./rnrow
      do 401 j=1,nrow
      y=j
      do 400 i=1,ncol
      g(i)=y*f
400   continue
      call rowio(g,y,1,ncol,10,2)
401   continue
      stop
      end
      subroutine rowio(a,y,nz,ncol,ld,key)
      dimension a(nz,ncol)
      go to (1,2),key
1     read(ld) y,a
      go to 90
2     write(ld)y,a
90    return
      end
