\name{PlotBox}
\alias{PlotBox}
\title{
Box-And-Whisker Plot of Time Series with Ensemble Distribution
}
\description{
Produce time series of box-and-whisker plot showing the distribution of the 
members of a forecast vs. the observed evolution. Only works for re-forecasts 
started each year.
}
\usage{
PlotBox(exp, obs, yr1, yr2, toptitle = '', ytitle = '', 
        expname = "exp 1", obsname = "obs 1", fileout = "output_PlotBox.ps")
}
\arguments{
  \item{exp}{
Forecast array of multi-member time series, e.g., the NAO index of one 
experiment. The expected dimensions are c(members, 
start dates/forecast horizons). A vector with only the time dimension can
also be provided.
  }
  \item{obs}{
Observational vector or array of time series, e.g., the NAO index of the 
observations that correspond the forecast data in \code{exp}.
The expected dimensions are c(start dates/forecast horizons) or 
c(1, start dates/forecast horizons). 
  }
  \item{yr1}{
Year of first forecast target period.
  }
  \item{yr2}{
Year of last forecast target period.
  }
  \item{toptitle}{
Title of the figure.
  }
  \item{ytitle}{
Side title of the figure.
  }
  \item{expname}{
Climate forecast system name.
  }
  \item{obsname}{
Name of the observational reference dataset.
  }
  \item{fileout}{
Name of the postscript output file, 'output_plotbox.ps' by default.
  }
}
\value{
Generates a file at the path specified via \code{fileout}.
}
\examples{
# See examples on Load() to understand the first lines in this example
  \dontrun{
data_path <- system.file('sample_data', package = 's2dverification')
expA <- list(name = 'experiment', path = file.path(data_path,
             'model/$EXP_NAME$/$STORE_FREQ$_mean/$VAR_NAME$_3hourly',
             '$VAR_NAME$_$START_DATE$.nc'))
obsX <- list(name = 'observation', path = file.path(data_path,
             '$OBS_NAME$/$STORE_FREQ$_mean/$VAR_NAME$',
             '$VAR_NAME$_$YEAR$$MONTH$.nc'))

# Now we are ready to use Load().
startDates <- c('19851101', '19901101', '19951101', '20001101', '20051101')
sampleData <- Load('tos', list(expA), list(obsX), startDates,
                   leadtimemin = 1, leadtimemax = 4, output = 'lonlat',
                   latmin = 27, latmax = 48, lonmin = -12, lonmax = 40,
                   configfile = configfile)
  }
  \dontshow{
startDates <- c('19851101', '19901101', '19951101', '20001101', '20051101')
sampleData <- s2dverification:::.LoadSampleData('tos', c('experiment'),
                                                c('observation'), startDates,
                                                leadtimemin = 1,
                                                leadtimemax = 4,
                                                output = 'lonlat',
                                                latmin = 27, latmax = 48,
                                                lonmin = -12, lonmax = 40)
  }
# Now ready to compute the EOFs and project on, for example, the first 
# variability mode.
ano <- Ano_CrossValid(sampleData$mod, sampleData$obs)
eof <- EOF(Mean1Dim(ano$ano_exp, 2)[1, , 1, , ], sampleData$lon, sampleData$lat)
nao <- NAO(ano$ano_exp, ano$ano_obs, sampleData$lon, sampleData$lat)
# Finally plot the nao index
PlotBox(nao$nao_exp[1, , ], nao$nao_obs[1, , ], 1, 5, "NAO index, NDJF", 
"NAO index (PC1) TOS", "Exp. A", "Obs. X")
}
\author{
History:\cr
0.1  -  2013-09  (F. Lienert, \email{flienert at ic3.cat})  -  Original code\cr
0.2  -  2015-03  (L. Batte, \email{lauriane.batte at ic3.cat})  -  Removed all\cr
normalization for sake of clarity.
1.0  -  2016-03  (N. Manubens, \email{nicolau.manubens at bsc.es})  -  Formatting to R CRAN
}
\seealso{
EOF, ProjectField, NAO
}
\keyword{datagen}
