Skip to content

Commit

Permalink
fix #361 removed deprecated parms in argo and ncdc functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jun 15, 2020
1 parent 25b9cd2 commit ef5ed2e
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 79 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: Client for many 'NOAA' data sources including the 'NCDC' climate
for 'NOAA' sea ice data, the 'NOAA' severe weather inventory, 'NOAA' Historical
Observing 'Metadata' Repository ('HOMR') data, 'NOAA' storm data via 'IBTrACS',
tornado data via the 'NOAA' storm prediction center, and more.
Version: 1.0.0.91
Version: 1.0.0.92
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-US
Expand Down
7 changes: 0 additions & 7 deletions R/argo.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ argo_buoy_files <- function(dac, id, ...) {
#' @export
#' @rdname argo
argo <- function(dac, id, cycle, dtype, ...) {
calls <- names(sapply(match.call(), deparse))[-1]
calls_vec <- "path" %in% calls
if (any(calls_vec)) {
stop("The parameter path has been removed, see docs for ?argo",
call. = FALSE)
}

path <- file.path(rnoaa_cache_dir(), "argo")
path <- file.path(path, dac)
apath <- a_local(dac, id, cycle, dtype, path)
Expand Down
10 changes: 1 addition & 9 deletions R/ncdc.r
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,8 @@

ncdc <- function(datasetid=NULL, datatypeid=NULL, stationid=NULL, locationid=NULL,
startdate=NULL, enddate=NULL, sortfield=NULL, sortorder=NULL, limit=25, offset=NULL,
token=NULL, dataset=NULL, datatype=NULL, station=NULL, location=NULL,
locationtype=NULL, page=NULL, year=NULL, month=NULL, day=NULL, includemetadata=TRUE,
results=NULL, add_units=FALSE, ...)
token=NULL, includemetadata=TRUE, add_units=FALSE, ...)
{
calls <- names(sapply(match.call(), deparse))[-1]
calls_vec <- c("dataset","datatype","station","location","locationtype","page","year","month","day","results") %in% calls
if (any(calls_vec)) {
stop("The parameters name, code, modifiedsince, startindex, and maxresults \n have been removed, and were only relavant in the old NOAA API v1. \n\nPlease see documentation for ?noaa")
}

token <- check_key(token)
args <- noaa_compact(list(datasetid = datasetid,
startdate = as.character(startdate), enddate = as.character(enddate),
Expand Down
19 changes: 7 additions & 12 deletions R/ncdc_datasets.r
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,16 @@
#' ncdc_datasets(locationid=c("FIPS:30103", "FIPS:30091"))
#' }

ncdc_datasets <- function(datasetid=NULL, datatypeid=NULL, stationid=NULL, locationid=NULL,
startdate=NULL, enddate=NULL, sortfield=NULL, sortorder=NULL, limit=25, offset=NULL,
token=NULL, dataset=NULL, page=NULL, year=NULL, month=NULL, ...)
ncdc_datasets <- function(datasetid=NULL, datatypeid=NULL, stationid=NULL,
locationid=NULL, startdate=NULL, enddate=NULL, sortfield=NULL,
sortorder=NULL, limit=25, offset=NULL, token=NULL, ...)
{
calls <- names(sapply(match.call(), deparse))[-1]
calls_vec <- c("dataset", "page", "year", "month") %in% calls
if (any(calls_vec))
stop("The parameters dataset, page, year, and month \n have been removed, and were only relavant in the old NOAA API v1. \n\nPlease see documentation for ?ncdc_datasets")

token <- check_key(token)

url <- paste0(ncdc_base(), "datasets")
if (!is.null(datasetid)) url <- paste(url, "/", datasetid, sep = "")
args <- noaa_compact(list(startdate=startdate,
enddate=enddate, sortfield=sortfield, sortorder=sortorder,
limit=limit, offset=offset))
enddate=enddate, sortfield=sortfield, sortorder=sortorder,
limit=limit, offset=offset))
if (!is.null(stationid)) {
stationid <- lapply(stationid, function(x) list(stationid = x))
}
Expand All @@ -81,7 +75,8 @@ ncdc_datasets <- function(datasetid=NULL, datatypeid=NULL, stationid=NULL, locat
dat <- data.frame(tt, stringsAsFactors = FALSE)
all <- list(meta = NULL, data = dat)
} else {
dat <- dplyr::bind_rows(lapply(tt$results, function(x) data.frame(x, stringsAsFactors = FALSE)))
dat <- dplyr::bind_rows(lapply(tt$results, function(x)
data.frame(x, stringsAsFactors = FALSE)))
all <- list(meta = tt$metadata$resultset, data = dat)
}
}
Expand Down
8 changes: 1 addition & 7 deletions R/ncdc_datatypes.r
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,8 @@

ncdc_datatypes <- function(datasetid=NULL, datatypeid=NULL, datacategoryid=NULL,
stationid=NULL, locationid=NULL, startdate=NULL, enddate=NULL, sortfield=NULL,
sortorder=NULL, limit=25, offset=NULL, token=NULL,
dataset=NULL, page=NULL, filter=NULL, ...)
sortorder=NULL, limit=25, offset=NULL, token=NULL, ...)
{
calls <- names(sapply(match.call(), deparse))[-1]
calls_vec <- c("dataset", "page", "filter") %in% calls
if (any(calls_vec))
stop("The parameters dataset, page, and filter \n have been removed, and were only relavant in the old NOAA API v1. \n\nPlease see documentation for ?ncdc_datatypes", call. = FALSE)

token <- check_key(token)

if (!is.null(datatypeid)) {
Expand Down
3 changes: 0 additions & 3 deletions man-roxygen/argo_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@
#' your machine to save files to, and run
#' \code{rappdirs::user_cache_dir("rnoaa/argo")} to get that directory.
#'
#' The \code{path} parameter used to be used to set where files are stored
#' on your machine.
#'
#' @section API Status:
#' The API weas down as of 2019-11-07, and probably some time before that. The
#' following functions were defunct:
Expand Down
3 changes: 0 additions & 3 deletions man/argo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 14 additions & 24 deletions man/ncdc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions man/ncdc_datasets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions man/ncdc_datatypes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ef5ed2e

Please sign in to comment.