On Thu, Feb 4, 2010 at 4:03 AM, karine heerah <karine.hee...@hotmail.fr> wrote:
>
> Hi everybody.
>
>
>
> i have 2 datasets : one with a long grid a lat grid and a bathymetry grid
>
> the second one only has the long and lat coordinates.
>
> So i want to know the bathymetry associated to the second dataset. I thought 
> it was a good idea to do an interpolation between the two datasets. I find a 
> script doing that on matlab but i want to do it on R. Do you how to do it?
>
>
>
> for ii = 1:length(seal_dive_depth07)
>
>    seal_bathy_depth07(ii) = 
> interp2(long,latg,A,seal_lon07(ii),seal_lat07(ii));
> end
>
>
>
> Karine HEERAH

There are several interpolation routines available that will take you
between these two grids.  The ones I used when preparing bathymetry
data for SWAN and ADCIRC models were:

>From the fields package:

   regular grid to regular grid ->   interp.surface.grid()
   regular grid to irregular grid -> interp.surface()

>From the akima package:

   irregular grid to regular grid -> interp()

As far as I recall, each of these routines uses either bilinear or
bicubic interpolation.

The routine as.image() may help you organize your data into the input
forms required by these functions.  The "sp" package may also help you
handle the spatial nature of the data.  "sp" contains a routine called
as.image.SpatialGridDataFrame()  that performs the same function as
as.image() on spatially gridded data.


There are several other packages available that implement methods
other than bilinear/cubic interpolation such as kriging, but I don't
have any first hand experience with them.


Hope this helps!

-Charlie

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to