      dimension wgt(30,30),wgt2(30,30),id(14),pgm(2)

      nover=10
      nc=30
      nr=30
      nz=1
      xo=0.
      dx=1.
      yo=0.
      dy=1.
      open(10,file='testwgt.out',form='unformatted',status='unknown')
      write(10) id,pgm,nc,nr,nz,xo,dx,yo,dy
      do 15 j=1,nover
      do 15 i=1,30
      if (j.le.i.and.j.le.(31-i)) then
        wgt(i,j)=float(j)/float(nover+1)
      else if (i.le.nover) then
        wgt(i,j)=float(i)/float(nover+1)
      else
        wgt(i,j)=float(31-i)/float(nover+1)
      endif
15    continue
      do 16 j=nover+1,30-nover
      do 16 i=1,30
      if(i.le.nover) then
        wgt(i,j)=float(i)/float(nover+1)
      else if(i.gt.(30-nover)) then
        wgt(i,j)=float(31-i)/float(nover+1)
      else
        wgt(i,j)=1.0
      endif
16    continue
      do 17 j=31-nover,30
      do 17 i=1,30
      if(j.ge.i.and.j.ge.(31-i)) then
        wgt(i,j)=float(31-j)/float(nover+1)
      else if(i.le.nover) then
        wgt(i,j)=float(i)/float(nover+1)
      else
        wgt(i,j)=float(31-i)/float(nover+1)
      endif
17    continue
c      do 21 j=1,30
c      do 21 i=1,30
c      wgt2(i,j)=wgt(i,j)
c21    continue
      do 18 j=1,nover
      do 18 i=1,nover
c      dist=sqrt(float((i-1-nover/2)**2 + (j-1-nover/2)**2))
c      dist=2.*dist/float(nover)
c      dist=min(dist,1.0)
cc            wgt(i,j)=dist
cc            wgt(31-i,j)=dist
cc            wgt(i,31-j)=dist
cc            wgt(31-i,31-j)=dist
c      wgt(i,j)=wgt(i,j)-(1.-dist)*.25
c      wgt(31-i,j)=wgt(31-i,j)-(1.-dist)*.25
c      wgt(i,31-j)=wgt(i,31-j)-(1.-dist)*.25
c      wgt(31-i,31-j)=wgt(31-i,31-j)-(1.-dist)*.25
      y=abs(float(j)-float(nover+1)/2.)/(float(nover+1)/2.)
      x=abs(float(i)-float(nover+1)/2.)/(float(nover+1)/2.)
      den=2. - max(x,y)
c      print*,i,j,x,y,den
      wgt(i,j)=wgt(i,j)/den
      wgt(31-i,j)=wgt(31-i,j)/den
      wgt(i,31-j)=wgt(i,31-j)/den
      wgt(31-i,31-j)=wgt(31-i,31-j)/den
18    continue
      do 20 j=1,30
c      do 19 i=1,30
c      wgt(i,j)=wgt2(i,j)/wgt(i,j)
c19    continue
      write(10) dlt,(wgt(i,j),i=1,30)
20    continue
      stop
      end

