Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CST_SaveExp.R
\name{SaveExp}
\alias{SaveExp}
\title{Save an experiment in a format compatible with CST_Load}
\usage{
SaveExp(
data,
lon,
lat,
Dataset,
var_name,
units,
startdates,
Dates,
cdo_grid_name,
projection,
destination
)
}
\arguments{
\item{data}{an multi-dimensional array with named dimensions (longitude, latitude, time, member, sdate)}
\item{Dataset}{a vector of character string indicating the names of the datasets}
\item{var_name}{a character string indicating the name of the variable to be saved}
\item{units}{a character string indicating the units of the variable}
\item{startdates}{a vector of dates indicating the initialization date of each simulations}
\item{Dates}{a matrix of dates with two dimension 'time' and 'sdate'.}
\item{cdo_grid_name}{a character string indicating the name of the grid e.g.: 'r360x181'}
\item{projection}{a character string indicating the projection name}
\item{destination}{a character string indicating the path where to store the NetCDF files}
\item{vector}{of latitud corresponding to the latitudinal dimension in data}
}
\value{
the function creates as many files as sdates per dataset. Each file could contain multiple members
The path will be created with the name of the variable and each Datasets.
}
\description{
This function is created for compatibility with CST_Load/Load for saving post-processed datasets such as those calibrated of downscaled with CSTools functions
}
\examples{
data <- lonlat_data$exp$data
lon <- lonlat_data$exp$lon
lat <- lonlat_data$exp$lat
Dataset <- 'XXX'
var_name <- 'tas'
units <- 'k'
startdates <- lapply(1:length(lonlat_data$exp$Datasets),
function(x) {
lonlat_data$exp$Datasets[[x]]$InitializationDates[[1]]})[[1]]
Dates <- lonlat_data$exp$Dates$start
dim(Dates) <- c(time = length(Dates)/length(startdates), sdate = length(startdates))
cdo_grid_name = attr(lonlat_data$exp$lon, 'cdo_grid_name')
projection = attr(lonlat_data$exp$lon, 'projection')
destination = '/esarchive/scratch/nperez/git/Flor/cstools/'
SaveExp(data, lon, lat, Dataset, var_name, units, startdates, Dates,
cdo_grid_name, projection, destination)
}
\author{
Perez-Zanon Nuria, \email{nuria.perez@bsc.es}
}