# [R] 2/3d interpolation from a regular grid to another regular grid

jiho jo.irisson at gmail.com
Wed Dec 5 11:44:31 CET 2007

```On 2007-December-04  , at 21:38 , Scionforbai wrote:
>> - krigging in package fields, which also requires irregular spaced
>> data
>
> That kriging requires irregularly spaced data sounds new to me ;) It
> cannot be, you misread something (I feel free to say that even if I
> never used that package).

Of Krigging I only know the name and general intent so I gladly line
I just read the description in ?Krig in the package fields which says:
" Fits a surface to irregularly spaced data. "
But there are probably other Krigging methods I overlooked.

> It can be tricky doing kriging, though, if you're not comfortable with
> a little bit of geostatistics. You have to infer a variogram model for
> each data set; you possibly run into non-stationarity or anisotropy,
> which are indeed very well treated (maybe at best) by kriging in one
> of its forms, but ... it takes more than this list to help you then;
> basically kriging requires modelling, so it is often very difficult to
> set up an automatic procedure. I can reccomend kriging if the spatial
> variability of your data (compared to grid refinement) is quite
> important.

This was the impression I had too: that Krigging is an art in itself
and that it requires you to know much about your data. My problem is
simpler: the variability is not very large between grid points (it is
oceanic current velocity data so it is highly auto-correlated
spatially) and I can get grids fine enough for variability to be low
anyway. So it is really purely numerical.

> In other simple cases, a wheighted mean using the (squared) inverse of
> the distance as wheight and a spherical neighbourhood could be the
> simpliest way to perform the interpolation.

Yes, that would be largely enough for me. I had C routines for 2D
polynomial interpolation of a similar cases and low order polynomes
gave good results. I just hoped that R had that already coded
somewhere in an handy and generic function rather than having to
recode it myself in a probably highly specialized and not reusable
manner.

Thank you very much for you answer and if someone knows a function
doing what is described above, that would be terrific.

JiHO
---
http://jo.irisson.free.fr/

```