usage of get1Dindex function ...

From: <u.utku.turuncoglu_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 27 2010 - 12:22:33 MDT

Hi,

I wrote the following procedure to sort x,y coordinate pair based on
selected one. The opt controls the behavior of the sort procedure. If the
value is equal to 1 then, it sorts the x values and match the correct y
with it.

undef("sort_xy")
procedure sort_xy(x:numeric, y:numeric, opt:numeric)
local x_old, y_old, x_ind, y_ind
begin
  ;--- sort x ---
  if (opt .eq. 1) then
    x_old = x
    qsort(x)
    x_ind = get1Dindex(x_old, x)
    y_old = y
    y = y(x_ind)
  ;--- sort y ---
  else
    y_old = y
    qsort(y)
    y_ind = get1Dindex(y_old, y)
    x_old = x
    x = x(y_ind)
  end if
end

when i run this procedure,

      xxx = (/ 3, 5, 2, 10, 6, 4, 3 /)
      yyy = (/ 1, 8, 4, 3 , 7, 6, 2 /)
      sort_xy(xxx, yyy, 1)

it gives the "fatal:Dimension sizes on right hand side of assignment do
not match dimension sizes of left hand side" error in the "get1Dindex"
call line. The dimension of the arrays y_old and y or x_old and x is same
and the second argument is sorted. I could not find the source of problem.
Is there any special requirement to use "get1Dindex" function? How can i
solve it?

Thanks,

--ufuk

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 27 12:22:50 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 29 2010 - 08:05:27 MDT