# [ncl-talk] Voronoi on sphere example - csvoro

legven at gmail.com legven at gmail.com
Sun Nov 9 03:03:37 MST 2014

```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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141109/1ea4f1ba/attachment.html
```