% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CST_RegimesAssign.R
\name{CST_RegimesAssign}
\alias{CST_RegimesAssign}
\title{Function for matching a field of anomalies with 
a set of maps used as a reference (e.g. clusters obtained from the WeatherRegime function)}
\usage{
CST_RegimesAssign(
  data,
  ref_maps,
  method = "distance",
  composite = FALSE,
  ncores = NULL
)
}
\arguments{
\item{data}{a 's2dv_cube' object}

\item{ref_maps}{Array with 3-dimensions (lon,lat, k) containing the maps  k=1,..,n maps that will be used as a reference for the matching.}

\item{method}{Whether the matching will be performed in terms of minimum distance (default=’distance’) or 
the maximum spatial correlation (method=’ACC’) between the maps.}

\item{ncores}{The number of multicore threads to use for parallel computation.}
}
\value{
A list with elements \code{$composite} (3-d array (lon, lat, k) containing the composites k=1,..,K for case (*1)
        \code{$pvalue} (3-d array (lon,lat, k) containing the pvalue of the composites obtained through a t-test 
        that accounts for the serial dependence of the data with the same structure as Composite.),
        \code{$cluster} (array with the same dimensions that data except latitude and longitude indicating the regime.maps to which each point is allocated.) ,
        \code{$frequency} (A vector of integers (from k=1,...k n reference maps) indicating the percentage of assignations corresponding to each map.),
}
\description{
This function performs the matching between a field of anomalies and a set
of maps which will be used as a reference. The anomalies will be assigned to the reference map 
for which the minimum Eucledian distance (method=’distance’) or highest spatial correlation 
(method=‘ACC’) is obtained.
}
\examples{
regimes <- CST_WeatherRegimes(data = lonlat_data$obs, EOFS = FALSE, ncenters = 4)$data
res1 <- CST_RegimesAssign(data=lonlat_data$exp, ref_maps = drop(regimes),composite=FALSE)
res2 <- CST_RegimesAssign(data=lonlat_data$exp, ref_maps = drop(regimes),composite=TRUE)
}
\references{
Torralba, V. (2019) Seasonal climate prediction for the wind energy sector: methods and tools
for the development of a climate service. Thesis. Available online: \url{https://eprints.ucm.es/56841/}
}
\author{
Verónica Torralba - BSC, \email{veronica.torralba@bsc.es}
}
