Skip to content

Commit

Permalink
removed erddap fxns, fix #95, fix #51, fix #73, fix #90
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed May 21, 2015
1 parent 84d2da5 commit ba265db
Show file tree
Hide file tree
Showing 28 changed files with 157 additions and 1,407 deletions.
7 changes: 2 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Description: An R client for many NOAA data sources including the NCDC
NOAA storm data via IBTrACS, and tornado data via the NOAA storm prediction
center. NOAA buoy data is only on the buoy branch in the Github repository
for this package (see url below).
Version: 0.3.6.9000
Version: 0.3.7.9000
Date: 2015-05-21
License: MIT + file LICENSE
Authors@R: c(person("Hart", "Edmund", role = "aut",
Expand All @@ -32,15 +32,12 @@ Imports:
ggplot2,
scales,
sp,
RCurl,
rgdal,
rgeos,
maptools,
XML,
data.table,
jsonlite,
digest,
reshape2
jsonlite
Suggests:
testthat,
roxygen2,
Expand Down
12 changes: 0 additions & 12 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Generated by roxygen2 (4.1.1): do not edit by hand

S3method(as.erddap_info,character)
S3method(as.erddap_info,erddap_info)
S3method(ncdc_plot,ncdc_data)
S3method(print,erddap_grid)
S3method(print,erddap_info)
S3method(print,erddap_search)
S3method(print,erddap_table)
S3method(print,ghcnd)
S3method(print,ghcnd_stations)
S3method(print,isd)
Expand All @@ -22,8 +16,6 @@ S3method(type_summ,integer)
S3method(type_summ,logical)
S3method(type_summ,matrix)
S3method(type_summ,numeric)
export(as.erddap_info)
export(disk)
export(erddap_clear_cache)
export(erddap_data)
export(erddap_datasets)
Expand Down Expand Up @@ -51,7 +43,6 @@ export(is.ncdc_stations)
export(isd)
export(isd_stations)
export(latlong2bbox)
export(memory)
export(ncdc)
export(ncdc_combine)
export(ncdc_datacats)
Expand Down Expand Up @@ -88,7 +79,6 @@ export(theme_ice)
export(tornadoes)
export(type_summ)
import(XML)
import(digest)
import(ggplot2)
import(httr)
import(maptools)
Expand All @@ -101,15 +91,13 @@ importFrom(dplyr,rbind_all)
importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(dplyr,tbl_df)
importFrom(jsonlite,fromJSON)
importFrom(lubridate,month)
importFrom(lubridate,today)
importFrom(lubridate,year)
importFrom(lubridate,ymd)
importFrom(plyr,compact)
importFrom(plyr,rbind.fill)
importFrom(plyr,round_any)
importFrom(reshape2,melt)
importFrom(rgeos,gBuffer)
importFrom(scales,date_breaks)
importFrom(scales,date_format)
Expand Down
42 changes: 2 additions & 40 deletions R/caching.R
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
#' Clear cached files
#'
#'
#' @name caching
#' @param path Path to location of cached files. Defaults to \code{disk()$path}
#' @param force (logical) Should we force removal of files if permissions say otherwise?
#' @details BEWARE: this will clear all cached files.
#' @details BEWARE: this will clear all cached files.

#' @export
#' @rdname caching
erddap_clear_cache <- function(path = disk(), force = FALSE) {
files <- list.files(path$path, full.names = TRUE)
unlink(files, recursive = TRUE, force = force)
}

#' @export
#' @rdname caching
ghcnd_clear_cache <- function(path = "~/.rnoaa/ghcnd", force = FALSE) {
files <- list.files(path, full.names = TRUE)
unlink(files, recursive = TRUE, force = force)
}

cache_get <- function(cache, url, args=list(), path="~/")
{
if(cache){
key <- if(!identical(args, list())) make_key(url, args) else url
hash <- digest::digest(key)
stored_hashes <- list.files(path, full.names=TRUE, pattern=".csv")
getname <- function(x) strsplit(x, "/")[[1]][length(strsplit(x, "/")[[1]])]
stored_hashes_match <- gsub("\\.csv", "", sapply(stored_hashes, getname, USE.NAMES=FALSE))
if(length(stored_hashes) == 0){
NULL
} else {
tt <- stored_hashes[stored_hashes_match %in% hash]
if(identical(tt, character(0))) NULL else tt
}
} else { NULL }
}

write_path <- function(path, url, args=list(), fmt="csv")
{
url <- if(!identical(args, list())) make_key(url, args) else url
hash <- digest::digest(url)
file.path(path, paste0(hash, paste0(".", fmt), sep=""))
}

make_key <- function(url, args)
{
tmp <- httr::parse_url(url)
tmp$query <- args
httr::build_url(tmp)
}
65 changes: 61 additions & 4 deletions R/defunct.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,58 @@ noaa_seaice <- function(...){
#' @export
#' @rdname erddap_data-defunct
#' @keywords internal
erddap_data <- function()
{
erddap_data <- function(){
.Defunct(msg = "See functions erddap_grid and erddap_table for griddap and tabledap data, respectively")
}

#' This function is defunct.
#' @export
#' @rdname erddap_clear_cache-defunct
#' @keywords internal
erddap_clear_cache <- function(){
.Defunct(package = "rerddap", msg = "See package rerddap")
}

#' This function is defunct.
#' @export
#' @rdname erddap_datasets-defunct
#' @keywords internal
erddap_datasets <- function(){
.Defunct(new = "ed_datasets", package = "rerddap", msg = "See ed_datasets() in package rerddap")
}

#' This function is defunct.
#' @export
#' @rdname erddap_grid-defunct
#' @keywords internal
erddap_grid <- function(){
.Defunct(new = "griddap", package = "rerddap", msg = "See griddap() in package rerddap")
}

#' This function is defunct.
#' @export
#' @rdname erddap_info-defunct
#' @keywords internal
erddap_info <- function(){
.Defunct(new = "info", package = "rerddap", msg = "See info() in package rerddap")
}

#' This function is defunct.
#' @export
#' @rdname erddap_search-defunct
#' @keywords internal
erddap_search <- function(){
.Defunct(new = "ed_search", package = "rerddap", msg = "See ed_search() in package rerddap")
}

#' This function is defunct.
#' @export
#' @rdname erddap_table-defunct
#' @keywords internal
erddap_table <- function(){
.Defunct(new = "tabledap", package = "rerddap", msg = "See tabledap() in package rerddap")
}

#' Defunct functions in rnoaa
#'
#' \itemize{
Expand All @@ -100,8 +147,18 @@ erddap_data <- function()
#' \item \code{\link{noaa_plot}}: Function name changed, prefixed with ncdc now
#' \item \code{\link{noaa_combine}}: Function name changed, prefixed with ncdc now
#' \item \code{\link{noaa_seaice}}: Function name changed to seaice
#' \item \code{\link{erddap_data}}: See the function \code{\link{erddap_grid}} for getting
#' griddap data and \code{\link{erddap_table}} for getting tabledap data.
#' \item \code{\link{erddap_data}}: See package rerddap
#' \item \code{\link{erddap_clear_cache}}: See package rerddap
#' \item \code{\link{erddap_datasets}}: Moved to \code{\link[rerddap]{ed_datasets}} in
#' package rerddap
#' \item \code{\link{erddap_grid}}: Moved to \code{\link[rerddap]{griddap}} in package
#' rerddap
#' \item \code{\link{erddap_info}}: Moved to \code{\link[rerddap]{info}} in package
#' rerddap
#' \item \code{\link{erddap_search}}: Moved to \code{\link[rerddap]{ed_search}} in
#' package rerddap
#' \item \code{\link{erddap_table}}: Moved to \code{\link[rerddap]{tabledap}} in
#' package rerddap
#' }
#'
#' @name rnoaa-defunct
Expand Down
34 changes: 0 additions & 34 deletions R/erddap.R

This file was deleted.

Loading

0 comments on commit ba265db

Please sign in to comment.