% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Sort.R
\name{Sort}
\alias{CircularSort}
\alias{Sort}
\title{Sort the coordinate variable values in a call to the function startR::Start}
\usage{
Sort(...)

CircularSort(start, end, ...)
}
\arguments{
\item{start}{A numeric indicating the lower bound of the circular range.}

\item{end}{A numeric indicating the upper bound of the circular range.}

\item{{\dots}}{Additional parameters to adjust the reorderig (sent internally 
to the function \code{sort()}).}
}
\value{
A list of 2 containing:
\item{$x}{
 The reordered values.
}
\item{$ix}{
 The permutation indices of $x in the original coordinate.
}
}
\description{
The reorder function intended for use as parameter \code{<dim_name>_reorder} 
in a call to the function \code{Start()}. This function complies with the 
input/output interface required by \code{Start()} defined in the documentation 
for the parameter \dots of that function.\cr
The coordinate applied to \code{Sort()} consists of an increasing or decreasing 
sort of the values. It is useful for adjusting the latitude order.\cr 
The coordinate applied to \code{CircularSort()} consists of a circular sort of 
values, where any values beyond the limits specified in the parameters 
\code{start} and \code{end} is applied a modulus to fall in the specified 
range. This is useful for circular coordinates such as the Earth longitudes.
}
\examples{
# Used in Start():
path <- paste0('/esarchive/exp/ecmwf/system5_m1/daily_mean/',
               '$var$_f6h/$var$_$sdate$.nc')
res <- Start(dat = path,
             var = 'psl',
             ensemble = 'first',
             sdate = '19821201',
             time = indices(1),
             latitude = values(list(-10, 10)),
             latitude_reorder = Sort(decreasing = TRUE),
             longitude = values(list(-10, 10)),
             longitude_reorder = CircularSort(-180, 180),
             synonims = list(latitude=c('lat','latitude'),
                             longitude=c('lon','longitude')),
             return_vars = list(latitude = 'dat',
                                longitude = 'dat',
                                time = NULL),
             retrieve = F)

}

