diff --git a/.Rbuildignore b/.Rbuildignore index 4910708..7e30453 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,6 +3,7 @@ .travis.yml README.Rmd README.md +_pkgdown.yml appveyor.yml Makefile cran-comments.md diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 37cf501..b34e988 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 1.0.1 -Date: 2022-12-11 16:47:03 UTC -SHA: 4aeb758c4163058461a701b5888180d67b4a3e94 +Version: 1.0.2 +Date: 2023-02-07 16:16:42 UTC +SHA: b5de651f0186ddfbee6a2f33387b2c07093d348e diff --git a/DESCRIPTION b/DESCRIPTION index f3c3a9d..43f9a29 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,8 +5,8 @@ Description: General purpose R client for 'ERDDAP' servers. Includes 'datasets', and fetch 'datasets', in either 'csv' or 'netCDF' format. 'ERDDAP' information: . -Version: 1.0.2 -Date: 2023-02-08 +Version: 1.0.3 +Date: 2023-06-09 License: MIT + file LICENSE Authors@R: c( person("Scott", "Chamberlain", role = "aut"), diff --git a/NEWS.md b/NEWS.md index b5f5b4b..af7e2c6 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +rerddap 1.0.3 +============= +This version provides exta checks on time bounds. + + rerddap 1.0.2 ============= Ensure '[' and ']' properly encoded in URL diff --git a/R/grid.R b/R/grid.R index 70f527e..5d0e808 100644 --- a/R/grid.R +++ b/R/grid.R @@ -25,6 +25,9 @@ griddap <- function(datasetx, ..., fields = 'all', stride = 1, fmt = "nc", if (attr(x, "type") != "griddap") stop("datasetid '", attr(x, "datasetid"), "' not of type griddap") check_dims(dimargs, x) + if (!is.null(dimargs$time)) { + check_time_range(dimargs, x) + } check_lat_text(dimargs) check_lon_text(dimargs) dimargs <- fix_dims(dimargs, .info = x) @@ -128,6 +131,12 @@ field_handler <- function(x, y){ } check_dims <- function(dimargs, .info) { + if (any(lengths(dimargs )!= 2)) { + print("All coordinate bounds must be of length 2, even if same value") + print("Present values are:") + print(dimargs) + stop("rerddap halted", call. = FALSE) + } if (!all(names(dimargs) %in% dimvars(.info))) { stop(sprintf("Some input dimensions (%s) don't match those in dataset (%s)", paste0(names(dimargs), collapse = ", "), @@ -169,6 +178,27 @@ is_lat_text <- function(dimargs) { } } +check_time_range <- function(dimargs, x) { +# if(!class(dimargs$time) == 'character'){ + if(!is.character(dimargs$time)){ + print('time must be given as character strings') + print('you are passing ', paste0(class(dimargs$time))) + stop('rerddap halted', call. = FALSE) + } + global <- x$alldata$NC_GLOBAL + tt <- global[ global$attribute_name %in%c('time_coverage_end','time_coverage_start'), "value", ] + tt <- rev(tt) + if((dimargs$time[1] < tt[1]) | (dimargs$time[2] > tt[2])) { + print('time bounds are out of range') + print('You gave: ') + print(dimargs$time) + print("Dataset times are: ") + print(tt) + stop('rerddap halted', call. = FALSE) + } +} + + check_lon_data_range <- function(dimargs, .info) { if (!is.null(dimargs$longitude)) { val <- .info$alldata$longitude[ .info$alldata$longitude$attribute_name == "actual_range", "value"] diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..aa21e76 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,77 @@ +reference: +- title: rerddap Package Description + contents: + - rerddap-package + +- title: Search + desc: > + Functions to search for ERDDAP servers as well as to search + ERDDAP for datasets whose metadata match the given search. + contents: + - ed_search + - ed_search_adv + - global_search + - servers + +- title: Obtain basic dataset metadata + + desc: > + Obtain the basic dataset metadata to help in subsetting and downloading. + contents: + - info + - browse + + +- title: Subset and Download Data + + desc: > + Functions to subset and download ERDDAP grids and tables. + contents: + - griddap + - tabledap + +- title: Optional Settings for Data Download + + desc: > + Optional settings for functions that subset and download ERDDAP grids and tables. + contents: + - disk + - eurl + - memory + +- title: Cache Handling + + desc: > + Functions for dealing with 'rerddap' cache. + contents: + - cache_delete + - cache_delete_all + - cache_details + - cache_info + - cache_list + - cache_setup + +- title: Various ERDDAP Based Utilities + + desc: > + Various ERDDAP based utilities for converting parameters. + contents: + - convert_time + - convert_units + - fipscounty + - key_words + - version + +- title: Datasets + + desc: > + Datasets used in the the functions nd vignette. + contents: + - colors + - institutions + - ioos_categories + - keywords + - longnames + - standardnames + - variablenames + diff --git a/codemeta.json b/codemeta.json index 2a4c135..f516b05 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,13 +8,13 @@ "codeRepository": "https://github.com/ropensci/rerddap", "issueTracker": "https://github.com/ropensci/rerddap/issues", "license": "https://spdx.org/licenses/MIT", - "version": "1.0.1", + "version": "1.0.3", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.2.2 (2022-10-31)", + "runtimePlatform": "R version 4.3.0 (2023-04-21)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -207,7 +207,7 @@ "applicationCategory": "Climate", "isPartOf": "https://ropensci.org", "keywords": ["earth", "science", "climate", "precipitation", "temperature", "storm", "buoy", "NOAA", "rstats", "erddap", "noaa-data", "api-client", "r", "r-package"], - "fileSize": "3003.519KB", + "fileSize": "3004.714KB", "releaseNotes": "https://github.com/ropensci/rerddap/blob/master/NEWS.md", "readme": "https://github.com/ropensci/rerddap/blob/master/README.md", "contIntegration": ["https://github.com/ropensci/rerddap/actions", "https://codecov.io/github/ropensci/rerddap?branch=master"] diff --git a/cran-comments.md b/cran-comments.md index 919ade6..3e6228d 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,6 @@ ## Test environments -* local macOS install, R 4.2.2 +* local macOS install, R 4.3.0 * rhub (devtools::check_rhub()) * macOS Builder (devtools::check_mac_release()) * win-builder (devel and release - devtools::check_win_*()) @@ -12,11 +12,10 @@ OK from all checks ## Reverse dependencies * I am maintainer of plotdap and rerddapXracto - they check out -* The maintainer of PAMmisc tested new version wih no problem --- -This version adds extra guarantees that cacheing behaves properly +This version provides exta checks on time bounds. Thanks! Roy Mendelssohn