Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

RF: f2py modification to stripackd. prb.py duplicates stripack_prob.f…

…90 except for triangle numbering
  • Loading branch information...
commit 9c8d594214e7e7fb76ce601bc1eccdbe0ec9c611 1 parent 39ed911
Ian Nimmo-Smith authored
169 original/src/prb.py
@@ -403,21 +403,36 @@
403 403 iwk(1) = n0
404 404 ds(1) = -1.0E+00
405 405 ksum = n0
  406 +'''
  407 +n0 = n/2
  408 +iwk[0] = n0
  409 +ds[0] = -1.0
  410 +ksum = n0
406 411
  412 +'''
407 413 do k = 2, n
408   -
409 414 call getnp ( x, y, z, list, lptr, lend, k, iwk, ds(k), ier )
410   -dsa,ier = sp.getnp(x,y,z,list,lptr,lend,npts)
411 415 if ( ier /= 0 .or. ds(k) < ds(k-1) ) then
412 416 write ( *, '(a)' ) ' '
413 417 write ( *, '(a)' ) 'STRIPACK_PRB - Fatal error!'
414 418 write ( *, '(a)' ) ' Error in GETNP.'
415 419 stop
416 420 end if
417   -
418 421 ksum = ksum + iwk(k)
419   -
420 422 end do
  423 +'''
  424 +
  425 +for k in np.arange(1,n):
  426 + ds[k], ier = sp.getnp(x,y,z,list,lptr,lend,iwk,k+1)
  427 + if ier != 0 or ds[k] < ds[k-1]:
  428 + print ' '
  429 + print 'STRIPACK_PRB - Fatal error!'
  430 + print ' Error in GETNP.'
  431 + #raise RuntimeError('Error in GETNP')
  432 + ksum += iwk[k]
  433 +
  434 +'''
  435 +
421 436 #!
422 437 #! Test for all nodal indexes included in IWK.
423 438 #!
@@ -427,6 +442,16 @@
427 442 # write ( *, '(a)' ) ' Error in GETNP.'
428 443 # stop
429 444 # end if
  445 +'''
  446 +
  447 +if ksum != (n*(n+1))/2 :
  448 + print ksum, '!=', (n*(n+1))/2
  449 + print 'STRIPACK_PRB - Fatal error!'
  450 + print ' Error in GETNP.'
  451 + raise RuntimeError('Error in GETNP')
  452 +
  453 +'''
  454 +
430 455 #!
431 456 #! Test NEARND by verifying that the nearest node to K is
432 457 #! node K for K = 1 to N.
@@ -447,6 +472,26 @@
447 472 # end if
448 473 #
449 474 # end do
  475 +'''
  476 +for k in range(n):
  477 +
  478 + p[0] = x[k]
  479 + p[1] = y[k]
  480 + p[2] = z[k]
  481 + al = 10.**6
  482 +
  483 + n0,al = sp.nearnd(p,k,x,y,z,list,lptr,lend)
  484 + #print n0, al
  485 + #if n0 != k+1 or al > 0.001 :
  486 + # print ' '
  487 + # print 'STRIPACK_PRB - Fatal error!'
  488 + # print ' Error in NEARND.'
  489 + # raise RuntimeError('Error in NEARND')
  490 +
  491 +#
  492 +# end do
  493 +'''
  494 +
450 495 #!
451 496 #! Test DELARC by removing a boundary arc if possible.
452 497 #! The last two nodes define a boundary arc
@@ -455,14 +500,22 @@
455 500 # n1 = n-1
456 501 # n2 = n
457 502 # call delarc ( n, n1, n2, list, lptr, lend, lnew, ier )
458   -#
  503 +'''
  504 +n1 = n-1
  505 +n2 = n
  506 +list,lptr,lend,lnew,ier = sp.delarc(n1,n2,list,lptr,lend,lnew)
  507 +'''
459 508 # if ( ier == 1 .or. ier == 4 ) then
460 509 # write ( *, '(a)' ) ' '
461 510 # write ( *, '(a)' ) 'STRIPACK_PRB - Warning!'
462 511 # write ( *, '(a,i6)' ) ' DELARC returned error code ', ier
463 512 # stop
464 513 # end if
465   -#
  514 +'''
  515 +if ier==1 or ier==3:
  516 + print 'STRIPACK_PRB - Warning! DELARC returned error code ', ier
  517 + raise RuntimeError('Error in DELARC')
  518 +'''
466 519 # if ( ier /= 0 ) then
467 520 #
468 521 # write ( *, '(a)' ) ' '
@@ -475,7 +528,15 @@
475 528 # ier )
476 529 #
477 530 # end if
478   -#!
  531 +'''
  532 +if ier!=0:
  533 + print ' Subroutine DELARC was not tested.'
  534 + print 'Nodes ', n1, ' and ', n2, 'do not form a removable boundary arc.'
  535 +else:
  536 + list,lptr,lend,lnew,ier = sp.trmesh(x,y,z)
  537 +
  538 +'''
  539 +!
479 540 #! Test CRLIST, VRPLOT, and SCOORD by constructing and
480 541 #! plotting the Voronoi diagram, and printing
481 542 #! the Voronoi region boundary (ordered
@@ -486,6 +547,11 @@
486 547 #!
487 548 # call crlist ( n, nmax, x, y, z, list, lend, lptr, lnew, &
488 549 # lbtri, listc, nb, xc, yc, zc, rc, ier )
  550 +
  551 +'''
  552 +lbtri,listc,nb,xc,yc,zc,rc,ier = sp.crlist(nmax,x,y,z,list,lend,lptr,lnew)
  553 +'''
  554 +
489 555 #
490 556 # if ( ier /= 0 ) then
491 557 # write ( *, '(a)' ) ' '
@@ -493,20 +559,46 @@
493 559 # write ( *, '(a,i6)' ) ' CRLIST returned error code ', ier
494 560 # stop
495 561 # end if
  562 +
  563 +'''
  564 +if ier != 0:
  565 + print 'STRIPACK_PRB - Warning! CRLIST returned error code ', ier
  566 + raise RuntimeError('Error in CRLIST')
  567 +#
  568 +'''
  569 +
496 570 #!
497 571 #! Use the same parameter values that were used for the
498 572 #! triangulation plot (except the output unit and title).
499 573 #!
500 574 # nt = 2 * n - 4
  575 +
  576 +'''
  577 +nt = 2*n-4
  578 +'''
  579 +
501 580 #
502 581 # vrplot_file_name = 'stripack_prb_vor.eps'
  582 +
  583 +'''
  584 +vrplot_file_name = 'pystripack_prb_vor.eps'
  585 +'''
  586 +
503 587 #
504 588 # vrplot_title = '(Voronoi diagram created by STRIPACK_PRB)'
  589 +
  590 +'''
  591 +vrplot_title = '(Voronoi diagram created by STRIPACK_PRB)'
  592 +'''
  593 +
505 594 #
506 595 # open ( lplv, file = vrplot_file_name )
507 596 #
508   -# call vrplot ( lplv, pltsiz, elat, elon, a, n, x, y, z, nt, listc, &
509   -# lptr, lend, xc, yc, zc, vrplot_title, numbr, ier )
  597 +
  598 +'''
  599 +ier = sp.vrplot ( vrplot_file_name, pltsiz, elat, elon, a, x, y, z, listc, lptr, lend, xc, yc, zc, vrplot_title, numbr)
  600 +
  601 +'''
510 602 #
511 603 # if ( ier == 0 ) then
512 604 # write ( *, '(a)' ) ' '
@@ -518,6 +610,17 @@
518 610 # write ( *, '(a,i6)' ) ' VRPLOT returned error code ', ier
519 611 # end if
520 612 #
  613 +
  614 +'''
  615 +if ier == 0:
  616 + print ''
  617 + print 'VRPLOT created the Voronoi plot file: ', vrplot_file_name
  618 + print ''
  619 +else:
  620 + print 'STRIPACK_PRB - Warning! VRPLOT returned error code ', ier
  621 + raise RuntimeError('VRPLOT error')
  622 +'''
  623 +
521 624 # n0 = 1
522 625 #
523 626 # write ( *, '(a)' ) ' '
@@ -526,6 +629,14 @@
526 629 # write ( *, '(a)' ) ' Triangle Latitude Longitude' // &
527 630 # ' Circumradius'
528 631 # write ( *, '(a)' ) ' '
  632 +
  633 +'''
  634 +n0 = 0
  635 +print ' Voronoi region for node ', n0+1
  636 +print ' '
  637 +print ' Triangle Latitude Longitude Circumradius'
  638 +print ' '
  639 +'''
529 640 #!
530 641 #! Initialize for loop on Voronoi vertices (triangle circumcenters).
531 642 #! The number of vertices is accumulated in NV, and the vertex indexes
@@ -552,6 +663,46 @@
552 663 # end if
553 664 #
554 665 # end do
  666 +
  667 +'''
  668 +nv = 0
  669 +lpl = lend[n0]
  670 +lp = lpl
  671 +'''
  672 +#
  673 +# do
  674 +#
  675 +# lp = lptr(lp)
  676 +# kt = listc(lp)
  677 +# nv = nv + 1
  678 +# iwk(nv) = kt
  679 +# call scoord ( xc(kt), yc(kt), zc(kt), vlat, vlon, vnrm )
  680 +# vlat = vlat / sc
  681 +# vlon = vlon / sc
  682 +# write ( *, '(i13,f13.6,f14.6,f17.6)' ) kt, vlat, vlon, rc(kt)
  683 +#
  684 +# if ( lp == lpl ) then
  685 +# exit
  686 +# end if
  687 +#
  688 +# end do
  689 +
  690 +'''
  691 +while True:
  692 +# print lp, lptr[lp]
  693 + lp = lptr[lp-1]
  694 + kt = listc[lp-1]
  695 + nv = nv + 1
  696 + iwk[nv] = kt-1
  697 + vlat,vlon,vnrm = sp.scoord(xc[kt-1], yc[kt-1], zc[kt-1])
  698 + vlat = vlat / sc
  699 + vlon = vlon / sc
  700 + print '%13d%13.6f%14.6f%17.6f' % (kt, vlat, vlon, rc[kt-1])
  701 +# write ( *, '(i13,f13.6,f14.6,f17.6)' ) kt, vlat, vlon, rc(kt)
  702 + if lp == lpl:
  703 + break
  704 +'''
  705 +
555 706 #!
556 707 #! Test INSIDE by checking for node N0 inside its Voronoi region.
557 708 #!
129 stripack/stripack_double.pyf
@@ -60,23 +60,23 @@ python module stripack_double ! in
60 60 integer :: lnew
61 61 end subroutine covsph
62 62 subroutine crlist(n,ncol,x,y,z,list,lend,lptr,lnew,ltri,listc,nb,xc,yc,zc,rc,ier) ! in :stripack_double:stripack/stripackd.f90
63   - integer optional,check(len(x)>=n),depend(x) :: n=len(x)
64   - integer optional,check(shape(ltri,1)==ncol),depend(ltri) :: ncol=shape(ltri,1)
65   - double precision dimension(n) :: x
66   - double precision dimension(n),depend(n) :: y
67   - double precision dimension(n),depend(n) :: z
68   - integer dimension(6 * n - 12),depend(n) :: list
69   - integer dimension(n),depend(n) :: lend
70   - integer dimension(6 * n - 12),depend(n) :: lptr
71   - integer :: lnew
72   - integer dimension(6,ncol) :: ltri
73   - integer dimension(6 * n - 12),depend(n) :: listc
74   - integer :: nb
75   - double precision dimension(2 * n - 4),depend(n) :: xc
76   - double precision dimension(2 * n - 4),depend(n) :: yc
77   - double precision dimension(2 * n - 4),depend(n) :: zc
78   - double precision dimension(2 * n - 4),depend(n) :: rc
79   - integer :: ier
  63 + integer optional,intent(in),check(len(x)>=n),depend(x) :: n=len(x)
  64 + integer intent(in) :: ncol
  65 + double precision dimension(n),intent(in) :: x
  66 + double precision dimension(n),intent(in),depend(n) :: y
  67 + double precision dimension(n),intent(in),depend(n) :: z
  68 + integer dimension(6 * n - 12),intent(in),depend(n) :: list
  69 + integer dimension(n),intent(in),depend(n) :: lend
  70 + integer dimension(6 * n - 12),intent(inout),depend(n) :: lptr
  71 + integer intent(inout) :: lnew
  72 + integer dimension(6,ncol),intent(out),depend(ncol) :: ltri
  73 + integer dimension(6 * n - 12),intent(out),depend(n) :: listc
  74 + integer intent(out) :: nb
  75 + double precision dimension(2 * n - 4),intent(out),depend(n) :: xc
  76 + double precision dimension(2 * n - 4),intent(out),depend(n) :: yc
  77 + double precision dimension(2 * n - 4),intent(out),depend(n) :: zc
  78 + double precision dimension(2 * n - 4),intent(out),depend(n) :: rc
  79 + integer intent(out) :: ier
80 80 end subroutine crlist
81 81 function d_pi() ! in :stripack_double:stripack/stripackd.f90
82 82 double precision :: d_pi
@@ -88,14 +88,14 @@ python module stripack_double ! in
88 88 double precision dimension(n),depend(n) :: z
89 89 end subroutine d3vec_normalize
90 90 subroutine delarc(n,io1,io2,list,lptr,lend,lnew,ier) ! in :stripack_double:stripack/stripackd.f90
91   - integer optional,check((len(list)+12)/(6)>=n),depend(list) :: n=(len(list)+12)/(6)
92   - integer :: io1
93   - integer :: io2
94   - integer dimension(6 * n - 12) :: list
95   - integer dimension(6 * n - 12),depend(n) :: lptr
96   - integer dimension(n),depend(n) :: lend
97   - integer :: lnew
98   - integer :: ier
  91 + integer optional,intent(in),check((len(list)+12)/(6)>=n),depend(list) :: n=(len(list)+12)/(6)
  92 + integer intent(in) :: io1
  93 + integer intent(in) :: io2
  94 + integer dimension(6 * n - 12),intent(in,out) :: list
  95 + integer dimension(6 * n - 12),intent(in,out),depend(n) :: lptr
  96 + integer dimension(n),intent(in,out),depend(n) :: lend
  97 + integer intent(in,out) :: lnew
  98 + integer intent(out) :: ier
99 99 end subroutine delarc
100 100 subroutine delnb(n0,nb,n,list,lptr,lend,lnew,lph) ! in :stripack_double:stripack/stripackd.f90
101 101 integer :: n0
@@ -141,7 +141,7 @@ python module stripack_double ! in
141 141 integer dimension(*) :: list
142 142 integer dimension(*),intent(in) :: lptr
143 143 integer dimension(*) :: lend
144   - integer optional,check(len(npts)>=l),depend(npts) :: l=len(npts)
  144 + integer optional,intent(in),check(len(npts)>=l),depend(npts) :: l=len(npts)
145 145 integer dimension(l),intent(inout) :: npts
146 146 double precision intent(out) :: df
147 147 integer intent(out) :: ier
@@ -217,17 +217,18 @@ python module stripack_double ! in
217 217 integer :: nbcnt
218 218 end function nbcnt
219 219 function nearnd(p,ist,n,x,y,z,list,lptr,lend,al) ! in :stripack_double:stripack/stripackd.f90
220   - double precision dimension(3) :: p
221   - integer :: ist
222   - integer optional,check(len(x)>=n),depend(x) :: n=len(x)
223   - double precision dimension(n) :: x
224   - double precision dimension(n),depend(n) :: y
225   - double precision dimension(n),depend(n) :: z
  220 + intent(out) nearnd
  221 + double precision dimension(3),intent(in) :: p
  222 + integer intent(in) :: ist
  223 + integer optional,intent(in),check(len(x)>=n),depend(x) :: n=len(x)
  224 + double precision dimension(n),intent(in) :: x
  225 + double precision dimension(n),intent(in),depend(n) :: y
  226 + double precision dimension(n),intent(in),depend(n) :: z
226 227 integer dimension(6 * n - 12),depend(n) :: list
227   - integer dimension(6 * n - 12),depend(n) :: lptr
228   - integer dimension(n),depend(n) :: lend
229   - double precision :: al
230   - integer :: nearnd
  228 + integer dimension(6 * n - 12),intent(in),depend(n) :: lptr
  229 + integer dimension(n),intent(in),depend(n) :: lend
  230 + double precision intent(out) :: al
  231 + integer intent(out) :: nearnd
231 232 end function nearnd
232 233 subroutine optim(x,y,z,na,list,lptr,lend,nit,iwk,ier) ! in :stripack_double:stripack/stripackd.f90
233 234 double precision dimension(*) :: x
@@ -242,12 +243,12 @@ python module stripack_double ! in
242 243 integer :: ier
243 244 end subroutine optim
244 245 subroutine scoord(px,py,pz,plat,plon,pnrm) ! in :stripack_double:stripack/stripackd.f90
245   - double precision :: px
246   - double precision :: py
247   - double precision :: pz
248   - double precision :: plat
249   - double precision :: plon
250   - double precision :: pnrm
  246 + double precision intent(in) :: px
  247 + double precision intent(in) :: py
  248 + double precision intent(in) :: pz
  249 + double precision intent(out) :: plat
  250 + double precision intent(out) :: plon
  251 + double precision intent(out) :: pnrm
251 252 end subroutine scoord
252 253 function store(x) ! in :stripack_double:stripack/stripackd.f90
253 254 double precision :: x
@@ -279,8 +280,8 @@ python module stripack_double ! in
279 280 end subroutine timestamp
280 281 subroutine trans(n,rlat,rlon,x,y,z) ! in :stripack_double:stripack/stripackd.f90
281 282 integer optional,intent(in),check(len(rlat)>=n),depend(rlat) :: n=len(rlat)
282   - double precision dimension(n),intent(in) :: rlat
283   - double precision dimension(n),intent(in),depend(n) :: rlon
  283 + double precision dimension(n) :: rlat
  284 + double precision dimension(n),depend(n) :: rlon
284 285 double precision dimension(n),intent(out),depend(n) :: x
285 286 double precision dimension(n),intent(out),depend(n) :: y
286 287 double precision dimension(n),intent(out),depend(n) :: z
@@ -369,26 +370,26 @@ python module stripack_double ! in
369 370 integer dimension(6 * n - 12),depend(n) :: lptr
370 371 integer dimension(6 * n - 12),depend(n) :: listc
371 372 end subroutine voronoi_poly_count
372   - subroutine vrplot(lun,pltsiz,elat,elon,a,n,x,y,z,nt,listc,lptr,lend,xc,yc,zc,title,numbr,ier) ! in :stripack_double:stripack/stripackd.f90
373   - integer :: lun
374   - double precision :: pltsiz
375   - double precision :: elat
376   - double precision :: elon
377   - double precision :: a
378   - integer optional,check(len(x)>=n),depend(x) :: n=len(x)
379   - double precision dimension(n) :: x
380   - double precision dimension(n),depend(n) :: y
381   - double precision dimension(n),depend(n) :: z
382   - integer optional,check((len(listc))/(3)>=nt),depend(listc) :: nt=(len(listc))/(3)
383   - integer dimension(3 * nt) :: listc
384   - integer dimension(6 * n - 12),depend(n) :: lptr
385   - integer dimension(n),depend(n) :: lend
386   - double precision dimension(nt),depend(nt) :: xc
387   - double precision dimension(nt),depend(nt) :: yc
388   - double precision dimension(nt),depend(nt) :: zc
389   - character*(*) :: title
390   - logical :: numbr
391   - integer :: ier
  373 + subroutine vrplot(filename,pltsiz,elat,elon,a,n,x,y,z,nt,listc,lptr,lend,xc,yc,zc,title,numbr,ier) ! in :stripack_double:stripack/stripackd.f90
  374 + character*(*) intent(in) :: filename
  375 + double precision intent(in) :: pltsiz
  376 + double precision intent(in) :: elat
  377 + double precision intent(in) :: elon
  378 + double precision intent(in) :: a
  379 + integer optional,intent(in),check(len(x)>=n),depend(x) :: n=len(x)
  380 + double precision dimension(n),intent(in) :: x
  381 + double precision dimension(n),intent(in),depend(n) :: y
  382 + double precision dimension(n),intent(in),depend(n) :: z
  383 + integer optional,intent(in),check((len(listc))/(3)>=nt),depend(listc) :: nt=(len(listc))/(3)
  384 + integer dimension(3 * nt),intent(in) :: listc
  385 + integer dimension(6 * n - 12),intent(in),depend(n) :: lptr
  386 + integer dimension(n),intent(in),depend(n) :: lend
  387 + double precision dimension(nt),intent(in),depend(nt) :: xc
  388 + double precision dimension(nt),intent(in),depend(nt) :: yc
  389 + double precision dimension(nt),intent(in),depend(nt) :: zc
  390 + character*(*) intent(in) :: title
  391 + logical intent(in) :: numbr
  392 + integer intent(out) :: ier
392 393 end subroutine vrplot
393 394 end interface
394 395 end python module stripack_double
358 stripack/stripackd.f90
@@ -73,16 +73,8 @@ subroutine addnod ( nst, k, x, y, z, list, lptr, lend, lnew, ier )
73 73 !
74 74 implicit none
75 75 !
76   - integer, intent (in) :: nst
77   - integer, intent (in) :: k
78   - double precision, intent (in) :: x(k)
79   - double precision, intent (in) :: y(k)
80   - double precision, intent (in) :: z(k)
81   - integer, intent (inout) :: list(*)
82   - integer, intent (inout) :: lptr(*)
83   - integer, intent (inout) :: lend(k)
84   - integer, intent (inout) :: lnew
85   - integer, intent (out) :: ier
  76 + integer k
  77 +!f2py intent (in) :: k
86 78 !
87 79 double precision b1
88 80 double precision b2
@@ -90,6 +82,8 @@ subroutine addnod ( nst, k, x, y, z, list, lptr, lend, lnew, ier )
90 82 integer i1
91 83 integer i2
92 84 integer i3
  85 + integer ier
  86 +!f2py intent (out) :: ier
93 87 integer in1
94 88 integer io1
95 89 integer io2
@@ -97,14 +91,30 @@ subroutine addnod ( nst, k, x, y, z, list, lptr, lend, lnew, ier )
97 91 integer kk
98 92 integer km1
99 93 integer l
  94 + integer lend(k)
  95 +!f2py intent (inout) :: lend
  96 + integer list(*)
  97 +!f2py intent (inout) :: list
  98 + integer lnew
  99 +!f2py intent (inout) :: lnew
100 100 integer lp
101 101 integer lpf
102 102 integer lpr
103 103 integer lpo1
104 104 integer lpo1s
  105 + integer lptr(*)
  106 +!f2py intent (inout) :: lptr
105 107 integer lstptr
  108 + integer nst
  109 +!f2py intent (in) :: nst
106 110 double precision p(3)
107 111 logical swptst
  112 + double precision x(k)
  113 +!f2py intent (in) :: x
  114 + double precision y(k)
  115 +!f2py intent (in) :: y
  116 + double precision z(k)
  117 +!f2py intent (in) :: z
108 118 !
109 119 kk = k
110 120
@@ -264,9 +274,9 @@ function arc_cosine ( c )
264 274 !
265 275 implicit none
266 276 !
267   - double precision, intent(in) :: c
268 277 double precision arc_cosine
269   -!
  278 + double precision c
  279 +!f2py intent(in) :: c
270 280 double precision c2
271 281 !
272 282 c2 = c
@@ -324,14 +334,10 @@ function areas ( v1, v2, v3 )
324 334 !
325 335 implicit none
326 336 !
327   - double precision, intent (in) :: v1(3)
328   - double precision, intent (in) :: v2(3)
329   - double precision, intent (in) :: v3(3)
330   - double precision areas
331   -!
332 337 double precision a1
333 338 double precision a2
334 339 double precision a3
  340 + double precision areas
335 341 double precision ca1
336 342 double precision ca2
337 343 double precision ca3
@@ -345,6 +351,12 @@ function areas ( v1, v2, v3 )
345 351 double precision u12(3)
346 352 double precision u23(3)
347 353 double precision u31(3)
  354 + double precision v1(3)
  355 +!f2py intent (in) :: v1
  356 + double precision v2(3)
  357 +!f2py intent (in) :: v2
  358 + double precision v3(3)
  359 +!f2py intent (in) :: v3
348 360 !
349 361 ! dv1(1:3) = dble ( v1(1:3) )
350 362 ! dv2(1:3) = dble ( v2(1:3) )
@@ -473,16 +485,22 @@ subroutine bdyadd ( kk, i1, i2, list, lptr, lend, lnew )
473 485 !
474 486 implicit none
475 487 !
476   - integer, intent (in) :: kk
477   - integer, intent (in) :: i1
478   - integer, intent (in) :: i2
479   - integer, intent (inout) :: list(*)
480   - integer, intent (inout) :: lptr(*)
481   - integer, intent (inout) :: lend(*)
482   - integer, intent (inout) :: lnew
483   -!
  488 + integer i1
  489 +!f2py intent (in) :: i1
  490 + integer i2
  491 +!f2py intent (in) :: i2
484 492 integer k
  493 + integer kk
  494 +!f2py intent (in) :: kk
  495 + integer lend(*)
  496 +!f2py intent (inout) :: lend
  497 + integer list(*)
  498 +!f2py intent (inout) :: list
  499 + integer lnew
  500 +!f2py intent (inout) :: lnew
485 501 integer lp
  502 + integer lptr(*)
  503 +!f2py intent (inout) :: lptr
486 504 integer lsav
487 505 integer n1
488 506 integer n2
@@ -603,21 +621,29 @@ subroutine bnodes ( n, list, lptr, lend, nodes, nb, na, nt )
603 621 !
604 622 implicit none
605 623 !
606   - integer, intent (in) :: n
607   - integer, intent (in) :: list(6*(n-2))
608   - integer, intent (in) :: lptr(6*(n-2))
609   - integer, intent (in) :: lend(n)
610   - integer, intent (out) :: nodes(n)
611   - integer, intent (out) :: nb
612   - integer, intent (out) :: nt
613   - integer, intent (out) :: na
  624 + integer n
  625 +!f2py intent (in) :: n
614 626 !
615 627 integer i
616 628 integer k
  629 + integer lend(n)
  630 +!f2py intent (in) :: lend
  631 + integer list(6*(n-2))
  632 +!f2py intent (in) :: list
617 633 integer lp
  634 + integer lptr(6*(n-2))
  635 +!f2py intent (in) :: lptr
618 636 integer n0
  637 + integer na
  638 +!f2py intent (out) :: na
  639 + integer nb
  640 +!f2py intent (out) :: nb
619 641 integer nn
  642 + integer nodes(n)
  643 +!f2py intent (out) :: nodes
620 644 integer nst
  645 + integer nt
  646 +!f2py intent (out) :: nt
621 647 !
622 648 nn = n
623 649 !
@@ -722,17 +748,21 @@ subroutine circum ( v1, v2, v3, c, ier )
722 748 !
723 749 implicit none
724 750 !
725   - double precision, intent (in) :: v1(3)
726   - double precision, intent (in) :: v2(3)
727   - double precision, intent (in) :: v3(3)
728   - double precision, intent (out) :: c(3)
729   - integer, intent (out) :: ier
730   -!
  751 + double precision c(3)
  752 +!f2py intent (out) :: c(3)
731 753 double precision cnorm
732 754 double precision cu(3)
733 755 double precision e1(3)
734 756 double precision e2(3)
735 757 integer i
  758 + integer ier
  759 +!f2py intent (out) :: ier
  760 + double precision v1(3)
  761 +!f2py intent (in) :: v1(3)
  762 + double precision v2(3)
  763 +!f2py intent (in) :: v2(3)
  764 + double precision v3(3)
  765 +!f2py intent (in) :: v3(3)
736 766 !
737 767 ier = 0
738 768
@@ -1005,7 +1035,9 @@ subroutine crlist ( n, ncol, x, y, z, list, lend, lptr, lnew, &
1005 1035 implicit none
1006 1036 !
1007 1037 integer n
  1038 +!f2py intent (in) :: n
1008 1039 integer ncol
  1040 +!f2py intent (in) :: ncol
1009 1041 !
1010 1042 double precision c(3)
1011 1043 integer i1
@@ -1013,6 +1045,7 @@ subroutine crlist ( n, ncol, x, y, z, list, lend, lptr, lnew, &
1013 1045 integer i3
1014 1046 integer i4
1015 1047 integer ier
  1048 +!f2py intent (out) :: ier
1016 1049 integer ierr
1017 1050 integer kt
1018 1051 integer kt1
@@ -1022,25 +1055,33 @@ subroutine crlist ( n, ncol, x, y, z, list, lend, lptr, lnew, &
1022 1055 integer kt21
1023 1056 integer kt22
1024 1057 integer lend(n)
  1058 +!f2py intent (in) :: lend(n)
1025 1059 integer list(6*(n-2))
  1060 +!f2py intent (in) :: list(6*(n-2))
1026 1061 integer listc(6*(n-2))
  1062 +!f2py intent (out) :: listc(6*(n-2))
1027 1063 integer lnew
  1064 +!f2py intent (inout) :: lnew
1028 1065 integer lp
1029 1066 integer lpl
1030 1067 integer lpn
1031 1068 integer lptr(6*(n-2))
  1069 +!f2py intent (inout) :: lptr(6*(n-2))
1032 1070 integer lstptr
1033 1071 integer ltri(6,ncol)
  1072 +!f2py intent (out) :: ltri(6,ncol)
1034 1073 integer n0
1035 1074 integer n1
1036 1075 integer n2
1037 1076 integer n3
1038 1077 integer n4
1039 1078 integer nb
  1079 +!f2py intent (out) :: nb
1040 1080 integer nm2
1041 1081 integer nn
1042 1082 integer nt
1043 1083 double precision rc(2*n-4)
  1084 +!f2py intent (out) :: rc(2*n-4)
1044 1085 logical swp
1045 1086 logical swptst
1046 1087 double precision t
@@ -1048,11 +1089,17 @@ subroutine crlist ( n, ncol, x, y, z, list, lend, lptr, lnew, &
1048 1089 double precision v2(3)
1049 1090 double precision v3(3)
1050 1091 double precision x(n)
  1092 +!f2py intent (in) :: x(n)
1051 1093 double precision xc(2*n-4)
  1094 +!f2py intent (out) :: xc(2*n-4)
1052 1095 double precision y(n)
  1096 +!f2py intent (in) :: y(n)
1053 1097 double precision yc(2*n-4)
  1098 +!f2py intent (out) :: yc(2*n-4)
1054 1099 double precision z(n)
  1100 +!f2py intent (in) :: z(n)
1055 1101 double precision zc(2*n-4)
  1102 +!f2py intent (out) :: zc(2*n-4)
1056 1103 !
1057 1104 nn = n
1058 1105 nb = 0
@@ -1622,17 +1669,25 @@ subroutine delarc ( n, io1, io2, list, lptr, lend, lnew, ier )
1622 1669 implicit none
1623 1670 !
1624 1671 integer n
  1672 +!f2py intent (in) :: n
1625 1673 !
1626 1674 integer ier
  1675 +!f2py intent (out) :: ier
1627 1676 integer io1
  1677 +!f2py intent (in) :: io1
1628 1678 integer io2
  1679 +!f2py intent (in) ::io2
1629 1680 integer lend(n)
  1681 +!f2py intent (in,out) :: lend(n)
1630 1682 integer list(6*(n-2))
  1683 +!f2py intent (in,out) :: list(6*(n-2))
1631 1684 integer lnew
  1685 +!f2py intent (in,out) :: lnew
1632 1686 integer lp
1633 1687 integer lph
1634 1688 integer lpl
1635 1689 integer lptr(6*(n-2))
  1690 +!f2py intent (in,out) :: lptr(6*(n-2))
1636 1691 integer lstptr
1637 1692 integer n1
1638 1693 integer n2
@@ -3140,22 +3195,27 @@ subroutine getnp ( x, y, z, list, lptr, lend, l, npts, df, ier )
3140 3195 implicit none
3141 3196 !
3142 3197 integer l
  3198 +!f2py intent (in) :: l
3143 3199 !
3144   - double precision, intent (out) :: df
  3200 + double precision df
  3201 +!f2py intent (out) :: df
3145 3202 double precision dnb
3146 3203 double precision dnp
3147 3204 integer i
3148   - integer, intent (out) :: ier
  3205 + integer ier
  3206 +!f2py intent (out) :: ier
3149 3207 integer lend(*)
3150 3208 integer list(*)
3151 3209 integer lp
3152 3210 integer lpl
3153   - integer, intent (in) :: lptr(*)
  3211 + integer lptr(*)
  3212 +!f2py intent (in) :: lptr(*)
3154 3213 integer n1
3155 3214 integer nb
3156 3215 integer ni
3157 3216 integer np
3158   - integer, intent(inout) :: npts(l)
  3217 + integer npts(l)
  3218 +!f2py intent(inout) :: npts(l)
3159 3219 double precision x(*)
3160 3220 double precision x1
3161 3221 double precision y(*)
@@ -4207,8 +4267,10 @@ function nearnd ( p, ist, n, x, y, z, list, lptr, lend, al )
4207 4267 !
4208 4268 integer, parameter :: lmax = 25
4209 4269 integer n
  4270 +!f2py intent (in) :: n
4210 4271 !
4211 4272 double precision al
  4273 +!f2py intent (out) :: al
4212 4274 double precision b1
4213 4275 double precision b2
4214 4276 double precision b3
@@ -4227,18 +4289,23 @@ function nearnd ( p, ist, n, x, y, z, list, lptr, lend, al )
4227 4289 integer i2
4228 4290 integer i3
4229 4291 integer ist
  4292 +!f2py intent (in) :: ist
4230 4293 integer l
4231 4294 integer lend(n)
  4295 +!f2py intent (in) :: lend
4232 4296 integer list(6*(n-2))
4233 4297 integer listp(lmax)
  4298 +!f2py intent (in) :: listp
4234 4299 integer lp
4235 4300 integer lp1
4236 4301 integer lp2
4237 4302 integer lpl
4238 4303 integer lptr(6*(n-2))
  4304 +!f2py intent (in) :: lptr
4239 4305 integer lptrp(lmax)
4240 4306 integer lstptr
4241 4307 integer nearnd
  4308 +!f2py intent (out) :: nearnd
4242 4309 integer n1
4243 4310 integer n2
4244 4311 integer n3
@@ -4246,9 +4313,13 @@ function nearnd ( p, ist, n, x, y, z, list, lptr, lend, al )
4246 4313 integer nr
4247 4314 integer nst
4248 4315 double precision p(3)
  4316 +!f2py intent (in) :: p
4249 4317 double precision x(n)
  4318 +!f2py intent (in) :: x
4250 4319 double precision y(n)
  4320 +!f2py intent (in) :: y
4251 4321 double precision z(n)
  4322 +!f2py intent (in) :: z
4252 4323 !
4253 4324 nearnd = 0
4254 4325 al = 0.0D+00
@@ -4693,11 +4764,17 @@ subroutine scoord ( px, py, pz, plat, plon, pnrm )
4693 4764 implicit none
4694 4765 !
4695 4766 double precision plat
  4767 +!f2py intent (out) :: plat
4696 4768 double precision plon
  4769 +!f2py intent (out) :: plon
4697 4770 double precision pnrm
  4771 +!f2py intent (out) :: pnrm
4698 4772 double precision px
  4773 +!f2py intent (in) :: px
4699 4774 double precision py
  4775 +!f2py intent (in) :: py
4700 4776 double precision pz
  4777 +!f2py intent (in) :: pz
4701 4778 !
4702 4779 pnrm = sqrt ( px*px + py*py + pz*pz )
4703 4780
@@ -5077,18 +5154,22 @@ subroutine trans ( n, rlat, rlon, x, y, z )
5077 5154 !
5078 5155 implicit none
5079 5156 !
5080   - integer, intent (in) :: n
5081   - double precision, intent (in) :: rlat(n)
5082   - double precision, intent (in) :: rlon(n)
5083   - double precision, intent (out) :: x(n)
5084   - double precision, intent (out) :: y(n)
5085   - double precision, intent (out) :: z(n)
  5157 + integer n
  5158 +!f2py intent (in) :: n
5086 5159 !
5087 5160 double precision cosphi
5088 5161 integer i
5089 5162 integer nn
5090 5163 double precision phi
  5164 + double precision rlat(n)
  5165 + double precision rlon(n)
5091 5166 double precision theta
  5167 + double precision x(n)
  5168 +!f2py double precision, intent (out) :: x(n)
  5169 + double precision y(n)
  5170 +!f2py double precision, intent (out) :: y(n)
  5171 + double precision z(n)
  5172 +!f2py double precision, intent (out) :: z(n)
5092 5173 !
5093 5174 nn = n
5094 5175
@@ -5693,33 +5774,41 @@ subroutine trlist ( n, list, lptr, lend, nrow, nt, ltri, ier )
5693 5774 !
5694 5775 implicit none
5695 5776 !
5696   - integer, intent (in) :: n
5697   - integer, intent (in) :: nrow
  5777 + integer n
  5778 +!f2py intent (in) :: n
  5779 + integer nrow
  5780 +!f2py intent (in) :: nrow
5698 5781 !
5699 5782 logical arcs
5700 5783 integer i
5701 5784 integer i1
5702 5785 integer i2
5703 5786 integer i3
5704   - integer, intent (out) :: ier
  5787 + integer ier
  5788 +!f2py intent (out) :: ier
5705 5789 integer isv
5706 5790 integer j
5707 5791 integer ka
5708 5792 integer kn
5709 5793 integer kt
5710   - integer, intent (in) :: lend(n)
5711   - integer, intent (in) :: list(6*(n-2))
  5794 + integer lend(n)
  5795 +!f2py intent (in) :: lend
  5796 + integer list(6*(n-2))
  5797 +!f2py intent (in) :: list
5712 5798 integer lp
5713 5799 integer lp2
5714 5800 integer lpl
5715 5801 integer lpln1
5716   - integer, intent (in) :: lptr(6*(n-2))
5717   - integer, intent (out) :: ltri(nrow,2*n-4)
  5802 + integer lptr(6*(n-2))
  5803 +!f2py intent (in) :: lptr
  5804 + integer ltri(nrow,2*n-4)
  5805 +!f2py intent (out) :: ltri
5718 5806 integer n1
5719 5807 integer n2
5720 5808 integer n3
5721 5809 integer nm2
5722   - integer, intent (out) :: nt
  5810 + integer nt
  5811 +!f2py intent (out) :: nt
5723 5812 !
5724 5813 ! Test for invalid input parameters.
5725 5814 !
@@ -5968,22 +6057,30 @@ subroutine trlprt ( n, x, y, z, iflag, nrow, nt, ltri )
5968 6057 !
5969 6058 implicit none
5970 6059 !
5971   - integer, intent (in) :: n
5972   - integer, intent (in) :: nrow
5973   - integer, intent (in) :: nt
  6060 + integer n
  6061 +!f2py intent (in) :: n
  6062 + integer nrow
  6063 +!f2py intent (in) :: nrow
  6064 + integer nt
  6065 +!f2py intent (in) :: nt
5974 6066 !
5975 6067 integer i
5976   - integer, intent (in) :: iflag
  6068 + integer iflag
  6069 +!f2py intent (in) :: iflag
5977 6070 integer k
5978   - integer, intent (in) :: ltri(nrow,nt)
  6071 + integer ltri(nrow,nt)
  6072 +!f2py intent (in) :: ltri
5979 6073 integer na
5980 6074 integer nb
5981 6075 integer nl
5982 6076 integer, parameter :: nlmax = 58
5983 6077 integer, parameter :: nmax = 9999
5984   - double precision, intent (in) :: x(n)
5985   - double precision, intent (in) :: y(n)
5986   - double precision, intent (in) :: z(n)
  6078 + double precision x(n)
  6079 +!f2py intent (in) :: x
  6080 + double precision y(n)
  6081 +!f2py intent (in) :: y
  6082 + double precision z(n)
  6083 +!f2py intent (in) :: z
5987 6084 !
5988 6085 ! Print a heading and test for invalid input.
5989 6086 !
@@ -6279,37 +6376,44 @@ subroutine trmesh ( n, x, y, z, list, lptr, lend, lnew, near, next, dist, ier )
6279 6376 !
6280 6377 implicit none
6281 6378 !
6282   - integer, intent (in) :: n
6283   - double precision, intent (in) :: x(n)
6284   - double precision, intent (in) :: y(n)
6285   - double precision, intent (in) :: z(n)
6286   - integer, intent (out) :: list(6*(n-2))
6287   - integer, intent (out) :: lptr(6*(n-2))
6288   - integer, intent (out) :: lend(n)
6289   - integer, intent (out) :: lnew
6290   -! workspace variables
6291   - integer near(n)
6292   - integer next(n)
6293   - double precision dist(n)
6294   -! Tell f2py these are workspace variables
6295   -!f2py integer, intent(hide, cache) :: near
6296   -!f2py integer, intent(hide, cache) :: next
6297   -!f2py double precision, intent(hide, cache) :: dist
6298   - integer, intent (out) :: ier
  6379 + integer n
  6380 +!f2py intent (in) :: n
6299 6381 !
6300 6382 double precision d
6301 6383 double precision d1
6302 6384 double precision d2
6303 6385 double precision d3
  6386 + double precision dist(n)
  6387 +!f2py intent(hide, cache) :: dist
6304 6388 integer i
6305 6389 integer i0
  6390 + integer ier
  6391 +!f2py intent (out) :: ier
6306 6392 integer j
6307 6393 integer k
6308 6394 logical left
  6395 + integer lend(n)
  6396 +!f2py intent (out) :: lend
  6397 + integer list(6*(n-2))
  6398 +!f2py intent (out) :: list
  6399 + integer lnew
  6400 +!f2py intent (out) :: lnew
6309 6401 integer lp
6310 6402 integer lpl
  6403 + integer lptr(6*(n-2))
  6404 +!f2py intent (out) :: lptr
  6405 + integer near(n)
  6406 +!f2py intent(hide, cache) :: near
  6407 + integer next(n)
  6408 +!f2py intent(hide, cache) :: next
6311 6409 integer nexti
6312 6410 integer nn
  6411 + double precision x(n)
  6412 +!f2py intent (in) :: x
  6413 + double precision y(n)
  6414 +!f2py intent (in) :: y
  6415 + double precision z(n)
  6416 +!f2py intent (in) :: z
6313 6417 !
6314 6418 nn = n
6315 6419
@@ -6666,36 +6770,45 @@ subroutine trplot ( filename, pltsiz, elat, elon, a, n, x, y, z, list, lptr, &
6666 6770 !
6667 6771 implicit none
6668 6772 !
6669   - integer, intent (in) :: n
  6773 + integer n
  6774 +!f2py intent (in) :: n
6670 6775 !
6671 6776 double precision a
6672 6777 logical, parameter :: annot = .true.
6673 6778 double precision cf
6674 6779 double precision ct
6675   - double precision, intent (in) :: elat
6676   - double precision, intent (in) :: elon
  6780 + double precision elat
  6781 +!f2py intent (in) :: elat
  6782 + double precision elon
  6783 +!f2py intent (in) :: elon
6677 6784 double precision ex
6678 6785 double precision ey
6679 6786 double precision ez
6680   - character ( len = * ), intent (in) :: filename
  6787 + character ( len = * ) filename
  6788 +!f2py intent (in) :: filename
6681 6789 double precision, parameter :: fsizn = 10.0D+00
6682 6790 double precision, parameter :: fsizt = 16.0D+00
6683   - integer, intent (out) :: ier
  6791 + integer ier
  6792 +!f2py intent (out) :: ier
6684 6793 integer ipx1
6685 6794 integer ipx2
6686 6795 integer ipy1
6687 6796 integer ipy2
6688 6797 integer ir
6689   - integer, intent (in) :: lend(n)
6690   - integer, intent (in) :: list(6*(n-2))
  6798 + integer lend(n)
  6799 +!f2py intent (in) :: lend
  6800 + integer list(6*(n-2))
  6801 +!f2py intent (in) :: list
6691 6802 integer lp
6692 6803 integer lpl
6693   - integer, intent (in) :: lptr(6*(n-2))
  6804 + integer lptr(6*(n-2))
  6805 +!f2py intent (in) :: lptr
6694 6806 integer, parameter :: lun = 7
6695 6807 integer n0
6696 6808 integer n1
6697 6809 logical numbr
6698   - double precision, intent (in) :: pltsiz
  6810 + double precision pltsiz
  6811 +!f2py intent (in) :: pltsiz
6699 6812 double precision r11
6700 6813 double precision r12
6701 6814 double precision r21
@@ -6703,18 +6816,22 @@ subroutine trplot ( filename, pltsiz, elat, elon, a, n, x, y, z, list, lptr, &
6703 6816 double precision r23
6704 6817 double precision sf
6705 6818 double precision t
6706   - character ( len = * ), intent (in) :: title
  6819 + character ( len = * ) title
  6820 +!f2py intent (in) :: title
6707 6821 double precision tx
6708 6822 double precision ty
6709 6823 double precision wr
6710 6824 double precision wrs
6711   - double precision, intent (in) :: x(n)
  6825 + double precision x(n)
  6826 +!f2py intent (in) :: x
6712 6827 double precision x0
6713 6828 double precision x1
6714   - double precision, intent (in) :: y(n)
  6829 + double precision y(n)
  6830 +!f2py intent (in) :: y
6715 6831 double precision y0
6716 6832 double precision y1
6717   - double precision, intent (in) :: z(n)
  6833 + double precision z(n)
  6834 +!f2py intent (in) :: z
6718 6835 double precision z0
6719 6836 double precision z1
6720 6837 !
@@ -7064,17 +7181,22 @@ subroutine trprnt ( n, x, y, z, iflag, list, lptr, lend )
7064 7181 !
7065 7182 implicit none
7066 7183 !
7067   - integer, intent (in) :: n
  7184 + integer n
  7185 +!f2py intent (in) :: n
7068 7186 !
7069 7187 integer i
7070   - integer, intent (in) :: iflag
  7188 + integer iflag
  7189 +!f2py intent (in) :: iflag
7071 7190 integer inc
7072 7191 integer k
7073 7192 integer lend(n)
7074   - integer, intent (in) :: list(6*(n-2))
  7193 + integer list(6*(n-2))
  7194 +!f2py intent (in) :: list
7075 7195 integer lp
7076 7196 integer lpl
7077   - integer, intent (in) :: lptr(6*(n-2))
  7197 + integer lptr(6*(n-2))
  7198 +!f2py intent (in) :: lptr
  7199 + integer, parameter :: lun = 7
7078 7200 integer na
7079 7201 integer nabor(400)
7080 7202 integer nb
@@ -7085,9 +7207,12 @@ subroutine trprnt ( n, x, y, z, iflag, list, lptr, lend )
7085 7207 integer nn
7086 7208 integer node
7087 7209 integer nt
7088   - double precision, intent (in) :: x(n)
7089   - double precision, intent (in) :: y(n)
7090   - double precision, intent (in) :: z(n)
  7210 + double precision x(n)
  7211 +!f2py intent (in) :: x
  7212 + double precision y(n)
  7213 +!f2py intent (in) :: y
  7214 + double precision z(n)
  7215 +!f2py intent (in) :: z
7091 7216 !
7092 7217 nn = n
7093 7218 !
@@ -7410,8 +7535,12 @@ subroutine voronoi_poly_count ( n, lend, lptr, listc )
7410 7535
7411 7536 return
7412 7537 end
7413   -subroutine vrplot ( lun, pltsiz, elat, elon, a, n, x, y, z, nt, listc, lptr, &
  7538 +!subroutine vrplot ( lun, pltsiz, elat, elon, a, n, x, y, z, nt, listc, lptr, &
  7539 +! lend, xc, yc, zc, title, numbr, ier)
  7540 +subroutine vrplot ( filename, pltsiz, elat, elon, a, n, x, y, z, nt, listc, lptr, &
7414 7541 lend, xc, yc, zc, title, numbr, ier)
  7542 +! The input LUN is dropped in preference for the output filename which we will OPEN here
  7543 +
7415 7544 !
7416 7545 !*******************************************************************************
7417 7546 !
@@ -7555,20 +7684,28 @@ subroutine vrplot ( lun, pltsiz, elat, elon, a, n, x, y, z, nt, listc, lptr, &
7555 7684 implicit none
7556 7685 !
7557 7686 integer n
  7687 +!f2py intent (in) :: n
7558 7688 integer nt
  7689 +!f2py intent (in) :: nt
7559 7690 !
7560 7691 double precision a
  7692 +!f2py intent (in) :: a
7561 7693 logical, parameter :: annot = .true.
7562 7694 double precision cf
7563 7695 double precision ct
7564 7696 double precision elat
  7697 +!f2py intent (in) :: elat
7565 7698 double precision elon
  7699 +!f2py intent (in) :: elon
7566 7700 double precision ex
7567 7701 double precision ey
7568 7702 double precision ez
  7703 + character ( len = * ) filename
  7704 +!f2py intent (in) :: filename