% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CST_Analogs.R
\name{CST_Analogs}
\alias{CST_Analogs}
\title{Downscaling using Analogs based on large scale fields.}
\usage{
CST_Analogs(expL, obsL, expVar, obsVar, criteria = "Large_dist")
}
\arguments{
\item{expL}{variable for the Large scale in the model (same variable 
might be used in the local scale for criteria 2)}

\item{obsL}{variable for the large scale in the observations}

\item{expVar}{variable for the local scale in the model usually different
to the variable in expL}

\item{obsVar}{variable for the local scale in the observations usually 
different to the variable in obsL}

\item{criteria}{different criteria to be used for the selection of analogs
if criteria = "Large_dist"
if criteria ="Local_dist"
if criteria ="Local_cor"}

\item{lon_local}{longitude in the local scale}

\item{lat_local}{latitude in the local scale}

\item{region}{region for the local scale}

\item{nAnalogs}{number of Analogs to be selected to apply the criterias (this
is not the necessary the number of analogs that the user can get)}

\item{return_list}{TRUE if you want to get a list with the best analogs FALSE 
if not.}

\item{mAnalogs}{months for searching the analogs}
}
\value{
list  list with the best analogs (time, distance)

values values of a certain variable
}
\description{
This function perform a downscaling using Analogs. To compute 
the analogs, the function search for days with similar large scale conditions
to downscaled fields in the local scale. 
The large scale and the local scale regions are defined by the user.
The large scale is usually given by atmospheric circulation as sea level 
pressure or geopotential height (Yiou et al, 2013) but the function gives the
possibility to use another field. The local scale will be usually given by 
precipitation or Temperature, but might be another variable. 
The analogs function will find the best analogs based in three criterias:
(1) Minimal distance in the large scale pattern (i.e. SLP)
(2) Minimal distance in the large scale pattern (i.e. SLP) and minimal 
distance in the local scale pattern (i.e. SLP). 
(3) Minimal distance in the large scale pattern (i.e. SLP), minimal 
distance in the local scale pattern (i.e. SLP) and maxima correlation in the 
local variable to downscale (i.e Precipitation).
The search of analogs must be done in the longest dataset posible. This is 
important since it is necessary to have a good representation of the 
possible states of the field in the past, and therefore, to get better 
analogs. Once the search of the analogs is complete, and in order to used the 
three criterias the user can select a number of analogs nAnalogs to restrict 
the selection of the best analogs in a short number of posibilities, the best
ones. By default this parameter will be 1.
This function has not constrains of specific regions, variables to downscale,
or data to be used (seasonal forecast data, climate projections data, 
reanalyses data). 
The regrid into a finner scale is done interpolating with CST_Load. 
Then, this interpolation is corrected selecting the analogs in the large 
and local scale in based of the observations. 
The function is an adapted version of the method of Yiou et al 2013.
}
\references{
Yiou, P., T. Salameh, P. Drobinski, L. Menut, R. Vautard,
and M. Vrac, 2013 : Ensemble reconstruction of the atmospheric column 
from surface pressure using analogues.  Clim. Dyn., 41, 1419-1437. 
\email{pascal.yiou@lsce.ipsl.fr}
}
\author{
Carmen Alvarez-Castro, \email{carmen.alvarez-castro@cmcc.it}

Nuria Perez-Zanon \email{nuria.perez@bsc.es}
}
