diff --git a/DESCRIPTION b/DESCRIPTION index f179cf3..bad9387 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,8 +11,8 @@ Suggests: loadeR, Type: Package Title: An R package for drought assessment fully integrated in the climate4R bundle -Version: 0.0.0 -Date: 2017-07-18 +Version: 0.0.1 +Date: 2017-07-20 Authors@R: as.person(c( "Santander Meteorology Group [ctb]", "Joaquin Bedia [aut, cre]", diff --git a/NEWS b/NEWS index a6baa0a..f3573c2 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,12 @@ -drought4R 0.0.0 -=============== - +v0.0.0 +====== * First package release +v0.0.1 +====== +* Bug fix (forgot to pass the ellipsis to the inner functions) + + + diff --git a/R/petGrid.R b/R/petGrid.R index 712fd1d..5af79dd 100644 --- a/R/petGrid.R +++ b/R/petGrid.R @@ -80,8 +80,8 @@ petGrid <- function(tasmin = NULL, ...) { method <- match.arg(method, choices = c("thornthwaite", "hargreaves")) out <- switch(method, - "thornthwaite" = petGrid.th(tas), - "hargreaves" = petGrid.har(tasmin, tasmax, pr)) + "thornthwaite" = petGrid.th(tas, ...), + "hargreaves" = petGrid.har(tasmin, tasmax, pr, ...)) ## Recover the grid structure ----------------------- coords <- getCoordinates(out$ref.grid) pet.grid <- out$ref.grid diff --git a/R/speiGrid.R b/R/speiGrid.R index ff899ee..0d3495a 100644 --- a/R/speiGrid.R +++ b/R/speiGrid.R @@ -33,11 +33,11 @@ #' @examples #' # By default, et0.grid is null, and SPI is computed from precipitation: #' data("pr.cru.iberia") -#' spi3 <- speiGrid(pr.grid = pr.cru.iberia, scale = 3) +#' spi3 <- speiGrid(pr.grid = pr.cru.iberia, scale = 3, na.rm = TRUE) #' ## If PET is used, then SPEI is calculated #' data("tas.cru.iberia") #' et0.grid <- petGrid(tas = tas.cru.iberia, method = "thornthwaite") -#' spei3 <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3) +#' spei3 <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3, na.rm = TRUE) speiGrid <- function(pr.grid, et0.grid = NULL, scale = 3, ...) { pr.grid <- redim(pr.grid, member = TRUE) @@ -61,7 +61,7 @@ speiGrid <- function(pr.grid, et0.grid = NULL, scale = 3, ...) { } wbalance <- pr - pet pt <- pet <- NULL - index <- spei(wbalance, scale, na.rm = TRUE) %>% extract2("fitted") %>% mat2Dto3Darray(x = coords$x, y = coords$y) + index <- spei(wbalance, scale, ...) %>% extract2("fitted") %>% mat2Dto3Darray(x = coords$x, y = coords$y) }) message("[", Sys.time(), "] Done") ## Recover the grid structure ----------------------- diff --git a/man/speiGrid.Rd b/man/speiGrid.Rd index 72956d8..3fafd92 100644 --- a/man/speiGrid.Rd +++ b/man/speiGrid.Rd @@ -28,11 +28,11 @@ to \strong{climate4R} input grids \examples{ # By default, et0.grid is null, and SPI is computed from precipitation: data("pr.cru.iberia") -spi3 <- speiGrid(pr.grid = pr.cru.iberia, scale = 3) +spi3 <- speiGrid(pr.grid = pr.cru.iberia, scale = 3, na.rm = TRUE) ## If PET is used, then SPEI is calculated data("tas.cru.iberia") et0.grid <- petGrid(tas = tas.cru.iberia, method = "thornthwaite") -spei3 <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3) +spei3 <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3, na.rm = TRUE) } \seealso{ \code{\link{petGrid}}, for PET calculation