From aa094c575a0c42cc84c8bd53a28b3cfe2f3d9a20 Mon Sep 17 00:00:00 2001 From: kauedesousa Date: Thu, 13 Jan 2022 12:47:33 +0100 Subject: [PATCH] remove-defaults-for-server --- NEWS.md | 4 ++-- R/get_chirps.R | 10 +++++----- README.md | 2 +- man/get_chirps.Rd | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1544444..e2ca46a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,9 +12,9 @@ chirps 0.1.4 (2022-01-13) ### CHANGES IN BEHAVIOUR +* New argument `server = ` is added to indicate from which server the function should send the request, either 'CHC' or 'ClimateSERV'. Please use the argument `server = "ClimateSERV"` for backward compatibility with previous versions of the package. * API requests to ClimateSERV use package httr instead of curl -* A new argument `server = ` is added to `get_chirps()` to indicate from which server the data will be requested. Options are 'CHC' the default and 'ClimateSERV' -* Argument `operation = ` in `get_chirps()` is removed from the main Usage and is only required when `server = "ClimateSERV"` +* Argument `operation = ` in `get_chirps()` is only required when `server = "ClimateSERV"` * Updates function `as.geojson()` to matches with the new requirements for ClimateSERV chirps 0.1.3 (2021-07-10) diff --git a/R/get_chirps.R b/R/get_chirps.R index 0a0bef0..6d34b4f 100644 --- a/R/get_chirps.R +++ b/R/get_chirps.R @@ -10,7 +10,7 @@ #' \code{\link[terra]{SpatRaster}}, \code{\link[sf]{sf}} or \code{geojson} #' @param dates a character of start and end dates in that order in the format #' "YYYY-MM-DD" -#' @param server a character that represent the server source "CHC" (default) or +#' @param server a character that represent the server source "CHC" or #' "ClimateSERV" #' @param as.sf logical, returns an object of class \code{\link[sf]{sf}} #' @param as.geojson logical, returns an object of class \code{geojson} @@ -90,7 +90,7 @@ #' @importFrom sf st_centroid read_sf st_geometry_type #' @importFrom terra crop extract rast #' @export -get_chirps <- function(object, dates, server = "CHC", ...) { +get_chirps <- function(object, dates, server, ...) { if (isFALSE(any(server %in% c("CHC", "ClimateSERV")))) { stop("Unknown server, please choose 'CHC' or 'ClimateSERV' \n") @@ -102,7 +102,7 @@ get_chirps <- function(object, dates, server = "CHC", ...) { #' @rdname get_chirps #' @export -get_chirps.default <- function(object, dates, server = "CHC", +get_chirps.default <- function(object, dates, server, as.matrix = FALSE, ...) { @@ -273,7 +273,7 @@ get_chirps.SpatRaster <- function(object, dates, server = "CHC", #' @rdname get_chirps #' @method get_chirps sf #' @export -get_chirps.sf <- function(object, dates, server = "CHC", +get_chirps.sf <- function(object, dates, server, as.sf = FALSE, ...) { @@ -411,7 +411,7 @@ get_chirps.sf <- function(object, dates, server = "CHC", #' @rdname get_chirps #' @method get_chirps geojson #' @export -get_chirps.geojson <- function(object, dates, server = "CHC", +get_chirps.geojson <- function(object, dates, server, as.geojson = FALSE, ...) { diff --git a/README.md b/README.md index 7e3ec3f..c76af36 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ lonlat <- data.frame(lon = c(-55.0281,-54.9857, -55.0714), dates <- c("2017-01-01", "2017-12-31") -dat <- get_chirps(lonlat, dates) +dat <- get_chirps(lonlat, dates, server = "CHC") ``` diff --git a/man/get_chirps.Rd b/man/get_chirps.Rd index 4ffa618..f6a6044 100644 --- a/man/get_chirps.Rd +++ b/man/get_chirps.Rd @@ -9,9 +9,9 @@ \alias{get_chirps.geojson} \title{Get CHIRPS precipitation data} \usage{ -get_chirps(object, dates, server = "CHC", ...) +get_chirps(object, dates, server, ...) -\method{get_chirps}{default}(object, dates, server = "CHC", as.matrix = FALSE, ...) +\method{get_chirps}{default}(object, dates, server, as.matrix = FALSE, ...) \method{get_chirps}{SpatVector}(object, dates, server = "CHC", as.raster = TRUE, ...) @@ -24,9 +24,9 @@ get_chirps(object, dates, server = "CHC", ...) ... ) -\method{get_chirps}{sf}(object, dates, server = "CHC", as.sf = FALSE, ...) +\method{get_chirps}{sf}(object, dates, server, as.sf = FALSE, ...) -\method{get_chirps}{geojson}(object, dates, server = "CHC", as.geojson = FALSE, ...) +\method{get_chirps}{geojson}(object, dates, server, as.geojson = FALSE, ...) } \arguments{ \item{object}{input, an object of class \code{\link[base]{data.frame}} (or @@ -36,7 +36,7 @@ any other object that can be coerced to data.frame), \code{\link[terra]{SpatVect \item{dates}{a character of start and end dates in that order in the format "YYYY-MM-DD"} -\item{server}{a character that represent the server source "CHC" (default) or +\item{server}{a character that represent the server source "CHC" or "ClimateSERV"} \item{...}{additional arguments passed to \code{\link[terra]{terra}}