Commit bc8ab127 authored by aho's avatar aho
Browse files

Merge branch 'develop-release_1.0.0' into 'master'

Develop release 1.0.0

See merge request !72
parents cc3a4aa1 a8437f1a
Pipeline #5869 passed with stage
in 4 minutes and 15 seconds
......@@ -3,8 +3,8 @@ stages:
build:
stage: build
script:
- module load R
- module load R/3.6.1-foss-2015a-bare
# - module load CDO
- R CMD build --resave-data .
- R CMD check --as-cran --no-manual --run-donttest s2dv_*.tar.gz
- R -e 'covr::package_coverage()'
# - R -e 'covr::package_coverage()'
Package: s2dv
Title: A Set of Common Tools for Seasonal to Decadal Verification
Version: 0.1.1
Version: 1.0.0
Authors@R: c(
person("BSC-CNS", role = c("aut", "cph")),
person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("aut", "cre")),
person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = "aut"),
person("Roberto", "Bilbao", , "roberto.bilbao@bsc.es", role = "ctb"),
person("Carlos", "Delgado", , "carlos.delgado@bsc.es", role = "ctb"),
person("Llorenç", "Lledó", , "llorenc.lledo@bsc.es", role = "ctb"),
person("Andrea", "Manrique", , "andrea.manrique@bsc.es", role = "ctb"),
person("Deborah", "Verfaillie", , "deborah.verfaillie@bsc.es", role = "ctb"))
Description: The advanced version of package 's2dverification'. It is
......@@ -21,7 +22,7 @@ Description: The advanced version of package 's2dverification'. It is
Depends:
maps,
methods,
R (>= 3.2.0)
R (>= 3.6.0)
Imports:
abind,
bigmemory,
......
# s2dv 1.0.0 (Release date: 2021-)
- Add parameter 'memb_dim' and 'memb' in Corr(). They allow the existence of the member dimension
# s2dv 1.0.0 (Release date: 2021-06-16)
- New functions:
ACC, Ano_CrossValid, BrierScore, CDORemap, Cluster, Consistent_Trend, EOF, EuroAtlanticTC, Filter, Histo2Hindcast,
NAO, Plot2VarsVsLTime, PlotACC, PlotBoxWhisker, PlotVsLTime, ProbBins, ProjectField, RatioRMS,
RatioSDRMS, REOF, Spectrum, Spread, StatSeasAtlHurr, UltimateBrier
- Season(): Accept one-dimension input.
- Persistence(): Add parameters checks for 'start' and 'end'; correct the output 'AR.lowCI' and 'AR.highCI'.
- Corr(): Add parameter 'member' and 'memb_dim'. They allow the existence of the member dimension
which can have different length between exp and obs, and users can choose to do the ensemble mean
first before correlation or calculate the correlation for individual member.
- Improve Persistence() input checks, and correct the output 'AR.lowCI' and 'AR.highCI'.
first before correlation or calculate the correlation for individual member.
- InsertDim(): Remove Apply() to improve the efficiency.
- Reorder(): Improve efficiency.
- Indices functions take the case without 'memb_dim' into consideration. The climatology calculation for the anomaly is member-dependent if member exists.
- PlotStereoMap(): Add contour and arrow feature.
- PlotAno(): Add parameter check for 'sdates'.
- PlotEquiMap(): Add new arguments 'contour_draw_label', 'lake_color', 'lab_dist_x', 'lab_dist_y', and 'degree_sym'. Fix the border error; the border grids are fully plotted now. Add ocean mask feature.
# s2dv 0.1.1 (Release date: 2020-11-16)
- Change the lincense to Apache License 2.0.
......
......@@ -8,6 +8,8 @@
#'@param lendim An integer indicating the length of the new dimension.
#'@param name A character string indicating the name for the new dimension.
#' The default value is NULL.
#'@param ncores An integer indicating the number of cores to use for parallel
#' computation. The default value is NULL. This parameter is deprecated now.
#'
#'@return An array as parameter 'data' but with the added named dimension.
#'
......@@ -18,7 +20,7 @@
#'
#'@import multiApply
#'@export
InsertDim <- function(data, posdim, lendim, name = NULL) {
InsertDim <- function(data, posdim, lendim, name = NULL, ncores = NULL) {
# Check inputs
## data
......@@ -59,6 +61,9 @@ InsertDim <- function(data, posdim, lendim, name = NULL) {
stop("Parameter 'name' must be a character string.")
}
}
## ncores
if (!missing("ncores"))
warning("Argument 'ncores' is deprecated.")
###############################
# Calculate InsertDim
......
......@@ -307,13 +307,15 @@ NAO <- function(exp = NULL, obs = NULL, lat, lon, time_dim = 'sdate',
target_dims = list(exp = c(memb_dim, time_dim, space_dim),
obs = c(time_dim, space_dim)),
fun = .NAO,
obsproj = obsproj, wght = wght, add_member_back = add_member_back,
lat = lat, wght = wght,
obsproj = obsproj, add_member_back = add_member_back,
ncores = ncores)
} else if (!is.null(exp)) {
res <- Apply(list(exp = exp),
target_dims = list(exp = c(memb_dim, time_dim, space_dim)),
fun = .NAO,
obsproj = obsproj, wght = wght, obs = NULL, add_member_back = FALSE,
lat = lat, wght = wght, obs = NULL,
obsproj = obsproj, add_member_back = FALSE,
ncores = ncores)
} else if (!is.null(obs)) {
if (add_member_back) {
......@@ -325,13 +327,14 @@ NAO <- function(exp = NULL, obs = NULL, lat, lon, time_dim = 'sdate',
target_dims = list(obs = c(time_dim, space_dim)),
output_dims = output_dims,
fun = .NAO,
obsproj = obsproj, wght = wght, exp = NULL, add_member_back = add_member_back,
lat = lat, wght = wght, exp = NULL,
obsproj = obsproj, add_member_back = add_member_back,
ncores = ncores)
}
return(res)
}
.NAO <- function(exp = NULL, obs = NULL, wght, obsproj = TRUE, add_member_back = FALSE) {
.NAO <- function(exp = NULL, obs = NULL, lat, wght, obsproj = TRUE, add_member_back = FALSE) {
# exp: [memb_exp, sdate, lat, lon]
# obs: [sdate, lat, lon]
# wght: [lat, lon]
......
......@@ -74,18 +74,18 @@
#'# Case 1: year
#'# Building an example dataset with yearly start dates from 1920 to 2009
#'set.seed(1)
#'obs1 <- rnorm(1 * 70 * 6 * 7)
#'dim(obs1) <- c(member = 1, time = 70, lat = 6, lon = 7)
#'obs1 <- rnorm(1 * 70 * 2 * 2)
#'dim(obs1) <- c(member = 1, time = 70, lat = 2, lon = 2)
#'dates <- seq(1920, 1989, 1)
#'res <- Persistence(obs1, dates = dates, start = 1961, end = 1980, ft_start = 1,
#' nmemb = 40)
#' nmemb = 2)
#'# Case 2: day
#'dates <- seq(as.Date(ISOdate(1990, 1, 1)), as.Date(ISOdate(1990, 4, 1)) ,1)
#'start <- as.Date(ISOdate(1990, 2, 15))
#'end <- as.Date(ISOdate(1990, 4, 1))
#'set.seed(1)
#'data <- rnorm(1 * length(dates) * 6 * 7)
#'dim(data) <- c(member = 1, time = length(dates), lat = 6, lon = 7)
#'data <- rnorm(1 * length(dates))
#'dim(data) <- c(member = 1, time = length(dates))
#'res <- Persistence(data, dates = dates, start = start, end = end, ft_start = 1)
#'
#'@import multiApply
......
......@@ -4,7 +4,7 @@
\alias{InsertDim}
\title{Add a named dimension to an array}
\usage{
InsertDim(data, posdim, lendim, name = NULL)
InsertDim(data, posdim, lendim, name = NULL, ncores = NULL)
}
\arguments{
\item{data}{An array to which the additional dimension to be added.}
......@@ -15,6 +15,9 @@ InsertDim(data, posdim, lendim, name = NULL)
\item{name}{A character string indicating the name for the new dimension.
The default value is NULL.}
\item{ncores}{An integer indicating the number of cores to use for parallel
computation. The default value is NULL. This parameter is deprecated now.}
}
\value{
An array as parameter 'data' but with the added named dimension.
......
......@@ -104,18 +104,18 @@ uncertainty (prediction interval) based on Coelho et al., 2004.\cr\cr
# Case 1: year
# Building an example dataset with yearly start dates from 1920 to 2009
set.seed(1)
obs1 <- rnorm(1 * 70 * 6 * 7)
dim(obs1) <- c(member = 1, time = 70, lat = 6, lon = 7)
obs1 <- rnorm(1 * 70 * 2 * 2)
dim(obs1) <- c(member = 1, time = 70, lat = 2, lon = 2)
dates <- seq(1920, 1989, 1)
res <- Persistence(obs1, dates = dates, start = 1961, end = 1980, ft_start = 1,
nmemb = 40)
nmemb = 2)
# Case 2: day
dates <- seq(as.Date(ISOdate(1990, 1, 1)), as.Date(ISOdate(1990, 4, 1)) ,1)
start <- as.Date(ISOdate(1990, 2, 15))
end <- as.Date(ISOdate(1990, 4, 1))
set.seed(1)
data <- rnorm(1 * length(dates) * 6 * 7)
dim(data) <- c(member = 1, time = length(dates), lat = 6, lon = 7)
data <- rnorm(1 * length(dates))
dim(data) <- c(member = 1, time = length(dates))
res <- Persistence(data, dates = dates, start = start, end = end, ft_start = 1)
}
......@@ -40,6 +40,7 @@ Other contributors:
\itemize{
\item Roberto Bilbao \email{roberto.bilbao@bsc.es} [contributor]
\item Carlos Delgado \email{carlos.delgado@bsc.es} [contributor]
\item Llorenç Lledó \email{llorenc.lledo@bsc.es} [contributor]
\item Andrea Manrique \email{andrea.manrique@bsc.es} [contributor]
\item Deborah Verfaillie \email{deborah.verfaillie@bsc.es} [contributor]
}
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment