 ! NOAA/PMEL TMAP
 ! Program FERRET (GUI)
 ! Version 4.91 - 05/19/98
 ! 29-Jul-98 11:09     

! Call scat2gridlaplace_xy 
! to put scattered data onto a regularly spaced grid.

! function definition from objective_analysis_demo.jnl

define axis/x=0:10:0.05 x10
define axis/y=0:10:0.05 y10
define grid/x=x10/y=y10 g10x10
set grid g10x10

let WAVE = SIN(KX*XPTS + KY*YPTS - PHASE) / 3
let PHASE = 0
let KAPPA = 0.4
let KX = 0.4
let KY = 0.7
let FCN1 = SIN(R)/(R+1)
let R = ((XPTS-X0)^2+ 5*(YPTS-Y0)^2)^0.5
let X0 = 3
let Y0 = 8

LET sample_function = fcn1 + wave

let xpts = x; let ypts = y
SHADE/title="A field with 200 sample points marked" sample_function 

let xpts = 10*randu(i); let ypts = 10*randu(i+2)
set region/i=1:200
plot/vs/over/symbols xpts,ypts

define axis/x=1:10:.5 xax5
define axis/y=1:10:.5 yax5
set wind/clear


set view ul
let sgrid = scat2gridlaplace_xy (xpts, ypts, sample_function, x[gx=xax5], y[gy=yax5], 5., 5)
SHADE/TITLE="Laplace Gridding (5,5) to 20x20 grid" sgrid 

set view ur
let sgrid = scat2gridlaplace_xy (xpts, ypts, sample_function, x[gx=xax5], y[gy=yax5], 1.,1)
SHADE/TITLE="Laplace Gridding (1,1) to 20x20" sgrid  

set view ll
let sgrid = scat2gridgauss_xy (xpts, ypts, sample_function, x[gx=xax5], y[gy=yax5], 0.5, 0.5, 2, 2)
SHADE/TITLE="Gauss Gridding (2) to 20x20 grid" sgrid  

set view lr
let sgrid = scat2gridgauss_xy (xpts, ypts, sample_function, x[gx=xax5], y[gy=yax5], 1.0, 1.0, 6,6)
SHADE/TITLE="Gauss Gridding (6) to 20x20 grid" sgrid  

set view full
set wind/clear

can mem /all
can var /all
can axis yax5
can axis xax5
set grid abstract
can grid g10x10
can axis y10
can axis x10
