! bn_samplexz.jnl
! check the samplexz function

define axis /y=-90:90:10 /units=latitude /edges ylat
define axis /z /depth /units=meters zdep={0,10,20,30,50,75,100,150,250}
define grid /y=ylat /z=zdep yzgrid

let my_data = y[g=yzgrid] + z[g=yzgrid]
show var my_data
show grid my_data
list z[g=yzgrid]

define axis /z=-25:325:50 /depth /units=meters zsampax
let zpts = ysequence(z[gz=zsampax])
let ypts = ysequence((randu(zpts) - 0.5) * 90)
let sampl_pts = sampleyz(my_data,ypts,zpts)
 
! check the results with a listing
list ypts, zpts, sampl_pts

