Skip to content

Commit 056b542

Browse files
committed
CRAN Version 1.1.0
tabledap now retrus values as same type as in the dds
1 parent 9662d98 commit 056b542

File tree

64 files changed

+38315
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+38315
-28
lines changed

.github/workflows/R-check.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
on: [push, pull_request]
2+
3+
name: R-check
4+
5+
jobs:
6+
R-check:
7+
runs-on: ${{ matrix.config.os }}
8+
9+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
config:
15+
- { os: windows-latest, r: 'release'}
16+
- { os: macOS-latest, r: 'release'}
17+
# - { os: macOS-latest, r: 'devel'}
18+
- { os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
19+
20+
env:
21+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
22+
RSPM: ${{ matrix.config.rspm }}
23+
VCR_VERBOSE_ERRORS: true
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- uses: r-lib/actions/setup-r@v1
29+
with:
30+
r-version: ${{ matrix.config.r }}
31+
32+
- uses: r-lib/actions/setup-pandoc@v1
33+
34+
- name: Query dependencies
35+
run: |
36+
install.packages('remotes')
37+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
38+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
39+
shell: Rscript {0}
40+
41+
- name: Cache R packages
42+
if: runner.os != 'Windows'
43+
uses: actions/cache@v2
44+
with:
45+
path: ${{ env.R_LIBS_USER }}
46+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
47+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
48+
49+
- name: install macOS system dependencies
50+
if: runner.os == 'macOS'
51+
continue-on-error: true
52+
run: |
53+
brew install pkg-config gdal udunits proj netcdf
54+
55+
- name: Install system dependencies
56+
if: runner.os == 'Linux'
57+
env:
58+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
59+
run: |
60+
sudo apt update
61+
sudo apt install -y --no-install-recommends \
62+
gdal-bin \
63+
libgdal-dev \
64+
libproj-dev \
65+
netcdf-bin
66+
67+
- name: Install dependencies
68+
run: |
69+
remotes::install_deps(dependencies = TRUE)
70+
remotes::install_cran(c("rcmdcheck", "taxize"))
71+
shell: Rscript {0}
72+
73+
- name: Session info
74+
run: |
75+
options(width = 100)
76+
pkgs <- installed.packages()[, "Package"]
77+
sessioninfo::session_info(pkgs, include_base = TRUE)
78+
shell: Rscript {0}
79+
80+
- name: Check
81+
env:
82+
_R_CHECK_CRAN_INCOMING_: false
83+
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
84+
shell: Rscript {0}
85+
86+
- name: Show testthat output
87+
if: always()
88+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
89+
shell: bash
90+
91+
- name: Upload check results
92+
if: failure()
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
96+
path: check
97+
98+
- name: Test coverage
99+
if: matrix.config.os == 'ubuntu-18.04' && matrix.config.r == 'release'
100+
run: |
101+
Rscript -e 'remotes::install_cran("covr")' -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'

CRAN-SUBMISSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 1.0.4
2-
Date: 2023-08-23 01:37:27 UTC
3-
SHA: 5c8c7179d4e63b927a08e707d8bb1c8b6bd0c693
1+
Version: 1.1.0
2+
Date: 2024-01-12 17:22:06 UTC
3+
SHA: 9662d98df70233be405dedcd27534c721b9136f5

DESCRIPTION

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Description: General purpose R client for 'ERDDAP' servers. Includes
55
'datasets', and fetch 'datasets', in either 'csv' or 'netCDF' format.
66
'ERDDAP' information:
77
<https://upwell.pfeg.noaa.gov/erddap/information.html>.
8-
Version: 1.0.4
9-
Date: 2023-08-23
8+
Version: 1.1.0
9+
Date: 2024-1-12
1010
License: MIT + file LICENSE
1111
Authors@R: c(
1212
person("Scott", "Chamberlain", role = "aut"),
@@ -23,16 +23,18 @@ Roxygen: list(markdown = TRUE)
2323
Encoding: UTF-8
2424
Language: en-US
2525
Imports:
26-
utils,
2726
crul (>= 0.7.4),
2827
dplyr (>= 0.5.0),
2928
data.table (>= 1.12.0),
30-
jsonlite (>= 1.6),
31-
xml2 (>= 1.2.0),
3229
digest,
30+
hoardr (>= 0.5.2),
31+
jsonlite (>= 1.6),
32+
lubridate,
33+
methods,
3334
ncdf4 (>= 1.16),
3435
tibble,
35-
hoardr (>= 0.5.2)
36+
utils,
37+
xml2 (>= 1.2.0)
3638
Suggests:
3739
knitr,
3840
rmarkdown

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
rerddap 1.1.0
2+
=============
3+
* 'tabledap()' responses now have the datatype given in the file .dds
4+
15
rerddap 1.0.4
26
=============
37
* fixes problem with time bounds check and "last"

R/ncdf_helpers.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ ncdf4_get <- function(file){
1212
for (i in seq_along(dims)) {
1313
out[[dims[i]]] <- ncdf4::ncvar_get(nc, nc$dim[[dims[i]]])
1414
}
15-
out$time <- sapply(out$time, convert_time)
15+
if ('time' %in% names(out)){
16+
out$time <- sapply(out$time, convert_time)
17+
18+
}
1619
vars <- names(nc$var)
1720
outvars <- list()
1821
for (i in seq_along(vars)) {

R/table.R

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,27 @@ tabledap <- function(x, ..., fields=NULL, distinct=FALSE, orderby=NULL,
208208
}
209209
resp <- erd_tab_GET(url, dset = attr(x, "datasetid"), store, callopts)
210210
loc <- if (store$store == "disk") resp else "memory"
211+
temp_table <- read_table(resp)
212+
# change response type
213+
dds_url <- sub('csv', 'dds', url)
214+
# strip off constraints
215+
amp_location <- regexpr("&", dds_url)
216+
if (amp_location[1] > 0) {
217+
dds_url <- substr(dds_url, 1, amp_location[1] - 1)
218+
}
219+
dds <- try(suppressWarnings(utils::read.table(dds_url)), silent = TRUE)
220+
# if (class(dds) == 'try-error') {
221+
if (methods::is(dds, 'try-error')) {
222+
print('failed to get variable datatype information')
223+
print('will leave units unchanged')
224+
} else{
225+
temp_table <- set_units(temp_table, dds)
226+
}
227+
228+
211229
structure(
212-
read_table(resp),
230+
#read_table(resp),
231+
temp_table,
213232
class = c("tabledap", "data.frame"),
214233
datasetid = attr(x, "datasetid"),
215234
path = loc,
@@ -262,3 +281,25 @@ makevar <- function(x, y){
262281
NULL
263282
}
264283
}
284+
285+
set_units <- function(temp_t, dds) {
286+
for (i in seq(3, (nrow(dds) - 2))) {
287+
var_type <- dds[i, 1]
288+
var_name <- dds[i, 2]
289+
var_name <- substr(var_name, 1, nchar(var_name)-1)
290+
if (var_name == 'time') {
291+
# make certain lubridate can convert time
292+
temp_time <- suppressWarnings(lubridate::as_datetime(temp_t$time))
293+
if (!any(is.na(temp_time))) {
294+
temp_t$time <- temp_time
295+
}
296+
} else {
297+
if (grepl('Float', var_type)) {
298+
temp_t[[var_name]] <- as.numeric(temp_t[[var_name]])
299+
} else if(grepl('Int', var_type)) {
300+
temp_t[[var_name]] <- as.integer(temp_t[[var_name]])
301+
}
302+
}
303+
}
304+
return(temp_t)
305+
}

cran-comments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Test environments
22

3-
* local macOS install, R 4.3.1
3+
* local macOS install, R 4.3.2
44
* rhub (devtools::check_rhub())
55
* macOS Builder (devtools::check_mac_release())
66
* win-builder (devel and release - devtools::check_win_*())
@@ -15,7 +15,7 @@ OK from all checks
1515

1616
---
1717

18-
This version fixes problems with the time bounds checks and "last"
18+
'tabledap()' responses now have the datatype given in the file .dds
1919

2020
Thanks!
2121
Roy Mendelssohn

man/rerddap-package.Rd

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

0 commit comments

Comments
 (0)