Hi all,
A few people have asked us how to generate an array of unique
integer indicies. We have added a new function that will be in
the next release, but it is simple enough to share here.
Both Christophe Cassou [CERFACS, Toulouse CEDEX France] and Dennis
Shea contributed to this fairly elegant solution. Note that the
function will be called "generate_unique_indicies", but I've renamed
it here to keep it conflicting with the new one coming up:
undef("gen_uniq_indicies")
function gen_uniq_indicies( N:integer)
local r
begin
r = random_uniform(0,100,N)
return( dim_pqsort(r, 1) )
end
To call it, you give it the number of unique indicies you want:
i = gen_uniq_indicies(50)
--Mary
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 14 2007 - 15:25:03 MDT
This archive was generated by hypermail 2.2.0 : Fri Sep 14 2007 - 15:44:49 MDT