Hi All,
All of this shows that it's important to do what Peter did when he
looked closely at his
results to see if they were reasonable. That's the way to
determine which methods are best for the given problem. Thanks for
bringing this up, Peter.
I just found an interesting page, which shows the value and the
limitations of spline interpolation:
http://jsxgraph.uni-bayreuth.de/wiki/index.php/Cubic_spline_interpolation
The intial picture shows a nice smooth curve between some scattered
points. Keep clicking on "add more points" and you'll see the spurious
peaks
and valleys that can show up between the scattered points which are
being fit with the curve. Below is a screen shot of one combination,
showing how the curve has to go way up and down to fit a polynomial
through the given points. In our Ferret function, when argument 6 is
large, we're doing a spline interpolation in 2 dimensions. If we've
chosen to use spline interpolation, and if the destination grid happens
to have
coordinate points at places where the spline
interpolation has gone way up or down, that's where the spurious peaks
come from. This isn't a bug, but just a fat of life when using the
particular method, which is good for some data and some choices of
parameters, and not so good for other combinations.
Ansley
Ansley Manke wrote:
Hi Peter,
The Laplacian gridding algorithm fits a surface function to the
scattered points and then interpolates to the grid from that surface.
This can result in the function values going above or below the
original data values. Have you tried different values for the function
arguments? Here is the documentation for SCAT2GRIDLAPLACE_XY about the
value of argument 6
CAY Amount of spline eqation (between 0 and inf.)
vs Laplace interpolation:
If CAY=0.0, Laplacian interpolation is used. The
resulting
surface tends to have rather sharp peaks and dips at the data points
(like a tent with poles pushed up into it). There is no chance of
spurious peaks appearing. As CAY is increased, Spline interpolation
predominates over the Laplacian, and the surface passes through the
data points more smoothly. The possibility of spurious peaks increases
with CAY. CAY= infinity is pure Spline interpolation. An over
relaxation process in used to perform the interpolation. A value of
CAY=5 often gives a good surface.
In particular, "The possibility of spurious peaks increases with CAY."
The interpolating function may well dip below zero as it is fit between
points; the higher value gives extra wiggles in the function. I can't
say for sure, but this may well be what's happening.
Compare the results if you use, say 5 and 5 for the last two arguments
to your call to SCAT2GRIDLAPLACE_XY. Is it better?
Because you have the 2-D longitude and latitude fields that define your
grid, another option for you is the CURV_TO_RECT functions. You might
want to check into that.
Ansley
Peter Szabo wrote:
Dear Users,
I have a daily precipitation data set on a lambert grid stored in ASCII
file.
I wanted to put this on a lat-lon grid with functions scat2gridlaplace
and/or scat2gridlaplace. (After ferret cant deal with Lambertian data
sets and I want to make some computations thats why i change its grid)
Somehow after the scat2gridlaplace my data contains truly negative
values. Does anyone know what mistake could i make? Or is it the
function thats not working properly?
Here is my script:
DEFINE AXIS/x=12.42:24.6/np=97 lons
DEFINE AXIS/y=44.9:49.92/np=61 lats
DEFINE AXIS/t="1-JAN-1961 12:00":"31-DEC-1990 12:00":1/t0="31-DEC-1960
12:00"/units=days time
DEFINE GRID/t=time/x=lons/y=lats gridxyt
DEFINE GRID/x=lons/y=lats gridxy
SET DATA/EZ/VARIABLES="lon,lat"/GRID=gridxy "ASCII_koord.txt" !->i
need the coordinate values from this file
let xx1D = XSEQUENCE(lon[d=1])
let yy1D = XSEQUENCE(lat[d=1])
SET DATA/EZ/VARIABLES="pre"/GRID=gridxyt "predaily.txt"
fill pre[l=@sum],lon[d=1],lat[d=1] !->I attach the picture of the
original data (AA.lambert.gif) created with similarly to this command
let
precipG=scat2gridgauss_xy(xx1d,yy1d,pre,x[gx=lons],y[gy=lats],0.01,0.01,10,0)
fill precipG[l=@sum] !-> the data looks like this after the gaussian
weightening (AA.gauss.gif)
let
precipL=scat2gridlaplace_xy(xx1D,yy1D,pre,x[gx=lons],y[gy=lats],100,100)
fill precipG[l=@sum] !-> the data looks like this after the laplace
interpolation (AA.laplace.gif)
Now the data is on a lat-lon grid and both looks pretty the same, but
if i count the minimum of the daily data the actual values are negative
in the case of scat2gridlaplace. (i attach also the minimum value of
the "laplace" data set. the two others dont have negative values larger
than 0.05).
I know i should use the gaussian weightening and interpolation, but
this bug/my fault still troubles me.
Thanks in advance,
Peter Szabo
|