Hello ferret community,
I am using @FNR in two dimensions and got an unexpected result (see
ferret script at end of this mail):
In the attached ferret_before_FNR.png, the original 2D grid cells are
shown (values inherited from dots by scat2grid, see below).
ferret_after_FNR.png shows the result after applying @FNR (fill with
nearest neighbor) in 2 dimensions.
As an example for the unexpected result, lets take the grid cell at
(x=8,y=5). Its value before @FNR was undefined. The nearest neighbor
is (x=8,y=8). Yet, the value is inherited from (x=2,y=4).
Is @FNR not supposed to be applied in 2D or is the logic behind
different from what I expected? It seems the missing points are always
filled up in x dimension first, and only remaining missing values are
then filled up in y direction ...
I attached a manual version of what I would have expected as
ferret_FNR_expected.png.
Thank you very much in advance for helping to clarify this.
Best regards,
Hella Riede
can var/all
can sym/all
let a = {1,1,8,8,2}
let b = {1,8,8,1,4}
let val = {2,4,6,8,10}
def ax/x=1:8:1 xax
def ax/y=1:8:1 yax
def sym lev = (1.5,10.5,1)
!! assign values from dots to grid cells
set win 1
let gridded =
SCAT2GRIDGAUSS_XY(a,b,val,x[gx=xax],y[gy=yax],0.8,0.8,0.8,0)
shade/lev=($lev) gridded
!! plot original scattered values for comparison
go polymark poly/lev=($lev)/key/ov/line/fill a b val circle 2
!! fill up undefined values with nearest neighbor
set win 2
let nn = gridded[x=@FNR,y=@FNR]
shade/lev=($lev) nn
go polymark poly/lev=($lev)/key/ov/line/fill a b val circle 2