\name{Histo2Hindcast}
\alias{Histo2Hindcast}
\title{
  Chunk Long Simulations
}
\description{
  This function reorganizes a long run (historical typically) with only one 
  start date into chunks corresponding to a set of start dates. The expected 
  input structure is the one output from load with 4 to 7 dimensions.
}
\usage{
  Histo2Hindcast(varin, sdatesin, sdatesout, nleadtimesout)
}
\arguments{
  \item{varin}{
    Input model or observational data:
      c(nmod/nexp/nobs, nmemb/nparam, nsdates, nltime) up to
      c(nmod/nexp/nobs, nmemb/nparam, nsdates, nltime, nlevel, nlat, nlon)
  }
  \item{sdatesin}{
    Start date of the input matrix 'YYYYMMDD'.
  }
  \item{sdatesout}{
    List of start dates of the output matrix c('YYYYMMDD', 'YYYYMMDD', ...).
  }
  \item{nleadtimesout}{
    Number of leadtimes in the output matrix.
  }
}
\value{
  A matrix with the same number of dimensions as the input one, the same 
  dimensions 1 and 2 and potentially the same dimensions 5 to 7. Dimensions 3 
  and 4 are set by the arguments sdatesout and nleadtimesout.
}
\author{
  History:
  1.0  -  2012-11  (V. Guemas, \email{vguemas@ic3.cat})  -  Original code
}
\keyword{datagen}
