% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AdamontNearestNeighbors.R
\name{NearestNeighbors}
\alias{NearestNeighbors}
\title{ADAMONT Nearest Neighbors computes the distance between reference data grid centroid and SF data grid}
\usage{
NearestNeighbors(exp, obs, method = "ADA")
}
\arguments{
\item{exp}{an object of class \code{s2dv_cube} as returned by \code{CST_Load} function, containing the seasonal forecast experiment longitudes in \code{$lon} and latitudes in \code{$lat}}

\item{obs}{an object of class \code{s2dv_cube} as returned by \code{CST_Load} function, containing the reference data on a different grid, with longitudes in \code{$lon} and latitudes in \code{$lat}.}

\item{method}{a string among three options ('ADA': standard ADAMONT distance, 'simple': lon/lat straight euclidian distance, 'radius': distance on the sphere)}
}
\value{
NN a list, containing the following:
         min_lon: array of dimensions \code{obs$lon} giving the longitude of closest gridpoint in exp
         min_lat: array of dimensions \code{obs$lat} giving the latitude of closest gridpoint in exp
         imin_lon: array of dimensions \code{obs$lon} giving the longitude index of closest gridpoint in exp
         imin_lat: array of dimensions \code{obs$lat} giving the latitude index of closest gridpoint in exp
}
\description{
This function computes the nearest neighbor for each reference data (lon, lat) point in the experiment dataset by computing the distance between the reference dataset grid and the experiment data. This is the first step in the ADAMONT method adapted from Verfaillie et al. (2018).
}
\author{
Paola Marson, \email{paola.marson@meteo.fr} for PROSNOW version

Lauriane Batté, \email{lauriane.batte@meteo.fr} for CSTools adaptation
}
