c  ck_dims
c
c  prints suggested values for new row and column dimensions
c  to be used in prepped grids
c
c  written by J.Phillips
c
      character*50 ifile
      dimension id(14),pgm(2)
C      print*, 'Enter input grid name (NO DVALS !):'
C        print 101
C101     format(' *',$)
C        read(5,1)ifile
C1       format(a50)
      ifile=' '
      call askin
      call askc('Enter input grid name (NO DVALS !)',ifile,ierr)
      if(ierr.lt.0) stop
C      open(10,file=ifile,status='old',form='unformatted')
C        read(10)id,pgm,nc,nr,nz,xo,dx,yo,dy
      call gopen(10,ifile,'old','read',ierr)
      call gheader('r',10,id,nc,nr,xo,dx,yo,dy,ierr)
        call fftdims(nc,nr)
        stop
        end
      subroutine fftdims(ncol, nrow)
c                                                                       
c        
      dimension nlist(54), ngood(54)
      data nlist / 9, 10, 11, 12, 13, 16
     &, 18, 20, 22, 24, 26, 32
     &, 36, 40, 44, 48, 52, 56, 64
     &, 72, 80, 88, 96, 104, 112, 128
     &, 144, 160, 176, 192, 208, 224, 256
     &, 288, 320, 352, 384, 416, 448, 512
     &, 576, 640, 704, 768, 832, 896, 1024
     &, 1152, 1280, 1408, 1536, 1664, 1792, 2048 /
c      min = min0(ncol,nrow)
c      if (min .eq. 1) min = max0(ncol,nrow)
c      max = max0(ncol + ncol/2,nrow + ncol/2)
      write(unit=6, fmt=901) ncol, nrow
  901 format(' ncol = ',i5,' nrow = ',i5)
      n = 0
      do 10 i = 1, 54
      if (nlist(i) .lt. ncol) goto 10
      if (nlist(i) .gt. ncol+ncol/2) goto 20
      n = n + 1
c                                                                       
c        
      ngood(n) = nlist(i)
   10 continue
   20 write(unit=6, fmt=902)
  902 format(' Suggested new values:')
c        
      write(unit=6, fmt=101) (ngood(i),i = 1, n)
  101 format('  ncol = ',14i5)
      n = 0
      do 30 i = 1, 54
      if (nlist(i) .lt. nrow) goto 30
      if (nlist(i) .gt. nrow+nrow/2) goto 40
      n = n + 1
c                                                                       
c        
      ngood(n) = nlist(i)
   30 continue
c        
   40   write(unit=6, fmt=102) (ngood(i),i = 1, n)
  102 format('  nrow = ',14i5)
      return 
      end

