      subroutine wghts(imx,jmx,inmax,jnmax,xo,yo,xn,yn,wti,wtj,idi,idj)
      dimension xo(imx),  yo(jmx),  xn(inmax),  yn(jnmax),  wti(inmax),
     ,         wtj(jnmax), idi(inmax), idj(jnmax)
c                                                                        
c     1st search for y partial weights                                   
      jmxm1=jmx-1
      imxm1=imx-1
      do 200 jn=1,jnmax
      do 100 jo=1,jmxm1
      if((yn(jn).ge.yo(jo)).and.(yn(jn).lt.yo(jo+1)))  go to 150
  100 continue
      write(6,3444)jn,jo,yn(jn),yo(jo),yo(jo+1)
3444  format(2x,2i5,3e11.5)
      stop 888
  150 wtj(jn)=(yn(jn)-yo(jo))/(yo(jo+1)-yo(jo))
      idj(jn)=jo
  200 continue
c     now search for x partial weights                                   
      do 400 in=1,inmax
      do 300 io=1,imxm1
      if((xn(in).ge.xo(io)).and.(xn(in).lt.xo(io+1)))  go to 350
  300 continue
      write(6,3446)in,io,xn(in),xo(io),xo(io+1)
3446  format(2x,2i5,3e11.5)
      stop 889
  350 wti(in)=(xn(in)-xo(io))/(xo(io+1)-xo(io))
      idi(in)=io
  400 continue
      return
      end
