[ncl-talk] Voronoi on sphere example - csvoro

Rick Brownrigg brownrig at ucar.edu
Mon Nov 10 10:25:30 MST 2014


Hi,

I'm not sure if this is your question or not, but rand will always produce
the same sequence with a given seed -- in your case since none is
specified, its some default value.  If you want different sequences across
successive runs, you might set the seed based upon the clock; e.g., this on
a linux system:

   ; call this before any calls to rand()
   srand(stringtoint(systemfunc("date +%s")))


Hope that helps...please write back to this list if not.
Rick


On Sun, Nov 9, 2014 at 3:03 AM, <legven at gmail.com> wrote:

> Dear NCL users,
> I have been trying to
> https://www.ncl.ucar.edu/Document/Functions/Built-in/csvoro.shtml:
>
> begin
>
> ;
> ;  Create input arrays.
> ;
>   ndata = 100
>   rlati = new(ndata,float)
>   rloni = new(ndata,float)
> ;
>   do i=0,ndata-1
>     rlati(i) =  -90. + 180.**rand* <https://www.ncl.ucar.edu/Document/Functions/Built-in/rand.shtml>()/32767.
>     rloni(i) = -180. + 360.**rand* <https://www.ncl.ucar.edu/Document/Functions/Built-in/rand.shtml>()/32767.
>   end do
>
> ;
> ;  Obtain the Voronoi polygon for the first point in the input
> ;  dataset.  nv(0:numv-1) will contain integers to be used as
> ;  indices for rlato and rlono to determine the polygonal vertices.
> ;
>   rlato = new(2*ndata,float)
>   rlono = new(2*ndata,float)
>   alen  = new(2*ndata,float)
>   nca   = new(1,integer)
>   numv  = new(1,integer)
>   nv    = new(ndata,integer)
>   *csvoro*(rlati,rloni,0,1,rlato,rlono,alen,nca,numv,nv)
>
> end
>
> I run this sample many times, but always numv will be <= 15 for ndata = 100 or ndata = 1000.
> Values of alen will be positive only for first numv index's.
>
> What's wrong?
>
> Many thanks.
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141110/198864fb/attachment.html 


More information about the ncl-talk mailing list