% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CST_RFTemp.R
\name{.interp2d}
\alias{.interp2d}
\title{Nearest neighbour interpolation}
\usage{
.interp2d(z, lon, lat, lonp, latp, method = "bilinear")
}
\arguments{
\item{z}{matrix with the input field to interpolate (assumed to
include also a third time dimension)}

\item{lon}{vector of input longitudes}

\item{lat}{vector of input latitudes}

\item{lonp}{vector of output longitudes}

\item{latp}{vector of output latitudes}

\item{method}{string indicating the interpolation method
("nearest" or "bilinear" (default))}
}
\value{
The interpolated field.
}
\description{
The input field is interpolated onto the output
coordinate grid using nearest neighbours or bilinear interpolation.
The input lon grid must be monotone increasing. 
The input lat grid can be irregularly spaced (e.g. a Gaussian grid)
The output grid can be irregularly spaced in lon and/or lat.
}
\examples{
lon=5:11
lat=35:40
z=runif(7*6*2); dim(z)=c(7,6,2)
lonp=seq(5,10,0.2)
latp=seq(35,40,0.2)
zo <- .interp2d(z, lon, lat, lonp, latp, method="nearest")
}
\author{
Jost von Hardenberg, \email{j.vonhardenberg@isac.cnr.it}
}
