diff --git a/DESCRIPTION b/DESCRIPTION index 82932749662559bc2486703db321dbabde0f3b4d..3259032e7759a3b32aede5c5008ce522823e1d09 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,11 @@ Package: ClimProjDiags Title: Set of Tools to Compute Various Climate Indices -Version: 0.0.4 +Version: 0.1.0 Authors@R: c( person("BSC-CNS", role = c("aut", "cph")), - person("Alasdair", "Hunter", , "alasdair.hunter@bsc.es", role = "aut"), - person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut", "cre")), + person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8568-3071")), person("Nicolau", "Manubens", , "nicolau.manubens@bsc.es", role = "ctb"), + person("Alasdair", "Hunter", , "alasdair.hunter@bsc.es", role = "aut"), person("Louis-Philippe", "Caron", , "louis-philippe.caron@bsc.es", role = "ctb")) Description: Set of tools to compute metrics and indices for climate analysis. The package provides functions to compute extreme indices, evaluate the diff --git a/R/Climdex.R b/R/Climdex.R index 20c3e4301c453c1eb8fc7b41f9044298a415a9b7..e8203fb1c96d8b5f19e46b89e7b3eabc74a22161 100644 --- a/R/Climdex.R +++ b/R/Climdex.R @@ -47,6 +47,9 @@ #' #'clim <- Climdex(data, metric = "t90p", threshold = thres) #'str(clim) +#'@references David Bronaugh for the Pacific Climate Impacts Consortium (2015). +#' climdex.pcic: PCIC Implementation of Climdex Routines. R package +#' version 1.1-6. http://CRAN.R-project.org/package=climdex.pcic #'@export Climdex <- function(data, metric, threshold = NULL, base.range = NULL, dates = NULL, timedim = NULL, calendar = NULL, ncores = NULL) { @@ -285,7 +288,7 @@ Climdex <- function(data, metric, threshold = NULL, base.range = NULL, dates = N if(spells.can.span.years) { all.true <- .tapply.fast(bools, date.factor, all) - max.spell <- .tapply.fast(get.series.lengths.at.ends(bools), date.factor, max) + max.spell <- .tapply.fast(.get.series.lengths.at.ends(bools), date.factor, max) ## Mask out values which are in the middle of a spell with NA na.mask <- c(1, NA)[as.integer((max.spell == 0) & all.true) + 1] diff --git a/R/Extremes.R b/R/Extremes.R index a60934044e546f29c5758e1b4f482c4fb75be81e..8fc5ca24a66425af6a9ed1396512de580c4df7d7 100644 --- a/R/Extremes.R +++ b/R/Extremes.R @@ -91,9 +91,9 @@ Extremes <- function(data, threshold, op = ">", min.length = 6, spells.can.span. if (!any(class(dates) %in% c('POSIXct'))) { dates <- try( { if (is.character(dates)) { - as.POSIXct(dates, format = "%Y%m%d", tz = "CET") + as.POSIXct(dates, format = "%Y%m%d") } else { - as.POSIXct(dates, format = "%Y%m%d", tz = "CET") + as.POSIXct(dates) } }) if ('try-error' %in% class(dates) | sum(is.na(dates)) == length(dates)) { @@ -113,8 +113,8 @@ Extremes <- function(data, threshold, op = ">", min.length = 6, spells.can.span. if (stop_error) { stop("Parameter 'dates' must be of the same length as the 'time' dimension of the parameter 'data'.") } - dates <- as.PCICt(dates, cal = calendar, format = "%Y%m%d") -# dates = as.character(dates) + dates <- as.PCICt(dates, cal = calendar) + dates = as.character(dates) jdays <- as.numeric(strftime(dates, format = "%j")) if (calendar == "gregorian" | calendar == "standard" | calendar == "proleptic_gregorian") { year <- as.numeric(strftime(dates, format = "%Y")) @@ -215,3 +215,4 @@ Extremes <- function(data, threshold, op = ">", min.length = 6, spells.can.span. threshold,op, min.length, spells.can.span.years, max.missing.days) } + diff --git a/man/Climdex.Rd b/man/Climdex.Rd index 3ff6bb76494faed3037cdf06037f308802799bf5..669570ab98f8060630d9df2ec90911deec345a1b 100644 --- a/man/Climdex.Rd +++ b/man/Climdex.Rd @@ -63,4 +63,9 @@ str(thres) clim <- Climdex(data, metric = "t90p", threshold = thres) str(clim) } +\references{ +David Bronaugh for the Pacific Climate Impacts Consortium (2015). + climdex.pcic: PCIC Implementation of Climdex Routines. R package + version 1.1-6. http://CRAN.R-project.org/package=climdex.pcic +} diff --git a/man/Extremes.Rd b/man/Extremes.Rd index 61b312a1914f656ed97245920cfa4c447052e535..0939fa67275433b18b9f62df84150911ea72e352 100644 --- a/man/Extremes.Rd +++ b/man/Extremes.Rd @@ -46,8 +46,7 @@ This routine compares data to the thresholds using the given operator, generatin ##Example synthetic data: data <- 1:(2 * 3 * 372 * 1) dim(data) <- c(time = 372, lon = 2, lat = 3, model = 1) -time <- as.POSIXct(paste(sort(rep(1900:1911, 31)), 1, 1:31, sep = "-"), tz = "CET", - format = "\%Y-\%m-\%d") +time <- as.POSIXct(paste(sort(rep(1900:1911, 31)), 1, 1:31, sep = "-"), tz = "CET") metadata <- list(time = list(standard_name = 'time', long_name = 'time', calendar = 'noleap', units = 'days since 1970-01-01 00:00:00', prec = 'double', dim = list(list(name = 'time', unlim = FALSE))))