Skip to content

Commit

Permalink
Tweaks to keep cran-checks happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rmendels committed Sep 30, 2022
1 parent d9713ce commit 5596054
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 78 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -6,7 +6,7 @@ Description: General purpose R client for 'ERDDAP' servers. Includes
'ERDDAP' information:
<https://upwell.pfeg.noaa.gov/erddap/information.html>.
Version: 1.0.0
Date: 2022-10-01
Date: 2022-10-02
License: MIT + file LICENSE
Authors@R: c(
person("Scott", "Chamberlain", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Expand Up @@ -4,7 +4,7 @@ rerddap 1.0.0
* griddap dataframe now uses the same coordinate names returned in 'rerddap::info()'
* all grids can now be "melted" into a dataframe, not just lat-lon grids
* fixed some bugs accessing some datasets not on lat-lon grid
* One vignette now included in package.
* vignette now included in package.

rerddap 0.8.0
=============
Expand Down
8 changes: 5 additions & 3 deletions cran-comments.md
@@ -1,16 +1,18 @@
## Test environments

* local macOS install, R 4.2.1
* rhub ubuntu, debian, solaris, Apple Silicon (M1), macOS 11.6 Big Sur
* win-builder (devel and release)
* rhub (devtools::check_rhub())
* macOS Builder (devtools::check_mac_release())
* win-builder (devel and release - devtools::check_win_*())

## R CMD check results

OK from all checks

## Reverse dependencies

* No probelms with reverse dependencies.
* I am maintainer of plotdap and rerddapXracto - they check out
* The maintainer of PAMmisc tested new version wih no problem

---

Expand Down
12 changes: 6 additions & 6 deletions vignettes/Using_rerddap.Rmd
Expand Up @@ -104,7 +104,7 @@ A list of some of the public available <span style="color:red">ERDDAP</span> ser
servers()
```

The list of <span style="color:red">ERDDAP</span> servers is based on the list maintained at the [Awesome ERDDAP site](https://irishmarineinstitute.github.io/awesome-erddap).
The list of <span style="color:red">ERDDAP</span> servers is based on the list maintained at the *Awesome ERDDAP* site compiled by the Irish Marine Institute.

The second way to find and obtain the desired data is to use functions in `rerddap`. The basic steps are:

Expand Down Expand Up @@ -198,15 +198,15 @@ Tables in <span style="color:red">ERDDAP</span> are subset by using "constraint

Note that in `tabledap()` character strings usually must be passed as "double-quoted", as seen in the example with the scientific name. A full `tabledap()` request to retrieve 'latitude', 'longitude', 'time', 'scientific_name', and 'subsample_count' with these constraints would be:

```{r cache = TRUE, eval = FALSE, echo = TRUE }
```{r, eval = FALSE, echo = TRUE }
CPSinfo <- info('FRDCPSTrawlLHHaulCatch')
sardines <- tabledap(CPSinfo, fields = c('latitude', 'longitude', 'time', 'scientific_name', 'subsample_count'), 'time>=2010-01-01', 'time<=2010-12-31', 'scientific_name="Sardinops sagax"' )
```

## Searching

The functions in `rerddap` work with any <span style="color:red">ERDDAP</span> server as long as the base URL is provided. A list of advertised <span style="color:red">ERDDAP</span> servers is provided at https://irishmarineinstitute.github.io/awesome-erddap and the `rerddap` function `servers()` will download this list.
The functions in `rerddap` work with any <span style="color:red">ERDDAP</span> server as long as the base URL is provided. A list of advertised <span style="color:red">ERDDAP</span> servers is provided by the Irish Marine Institute's *Awesome ERDDAP* web page, and the `rerddap` function `servers()` will download this list.

Given a base <span style="color:red">ERDDAP</span> URL, the function `ed_search()` will search the server for the given search terms. The default <span style="color:red">ERDDAP</span> server is https://upwell.pfeg.noaa.gov/erddap/. Alternately, the function `global_search()` will search a list of <span style="color:red">ERDDAP</span> servers for the given search terms. The function `ed_datasets()` lists the datasets available from the given <span style="color:red">ERDDAP</span> server.

Expand Down Expand Up @@ -326,7 +326,7 @@ ggplot(data = viirsCHLA$data, aes(x = longitude, y = latitude, fill = log(chla))

### Temperature at 70m in the north Pacific from the SODA model output

This is an example of an extract from a 4-D dataset (results from the "Simple Ocean Data Assimilation (SODA)" model - see https://www.atmos.umd.edu/~ocean/), and illustrate the case where the z-coordinate does not have the default name "altitude". Water temperature at 70m depth is extracted for the North Pacific Ocean.
This is an example of an extract from a 4-D dataset (results from the "Simple Ocean Data Assimilation (SODA)" model - see https://www2.atmos.umd.edu/~ocean/), and illustrate the case where the z-coordinate does not have the default name "altitude". Water temperature at 70m depth is extracted for the North Pacific Ocean.


```{r eval = FALSE, echo = TRUE}
Expand Down Expand Up @@ -368,7 +368,7 @@ myplot

### Irish Marine Institute {#hourly}

The Irish Marine Institute has an <span style="color:red">ERDDAP</span> server at https://erddap.marine.ie/erddap. Among other datasets, they have hourly output from a model of the North Altantic ocean, with a variety of ocean related parameters, see https://erddap.marine.ie/erddap/griddap/IMI_NEATL.html. To obtain the latest sea surface salinity for the domain of the model:
The Irish Marine Institute has an <span style="color:red">ERDDAP</span> server at https://erddap.marine.ie/erddap. Among other datasets, they have hourly output from a model of the North Altantic ocean, with a variety of ocean related parameters, see the dataset *IMI_NEATL*. To obtain the latest sea surface salinity for the domain of the model:

```{r NAtlSSS, eval = FALSE, echo = TRUE}
require("rerddap")
Expand Down Expand Up @@ -721,7 +721,7 @@ z + geom_polygon(data = w, aes(x = long, y = lat, group = group), fill = "grey80

## California Current System Integrated Ecosystem Assessment (CCSIEA)

The primary goals of the CCIEA are to better understand the web of interactions that drive patterns and trends of components within the California Current ecosystem, and forecast how changing environmental conditions and management actions affect the status of these components. The conceptual model of the social-ecological system of the California Current illustrates how humans and their social systems are inextricably linked to these marine, coastal, and upland environments (see https://www.integratedecosystemassessment.noaa.gov/regions/california-current-region/index.html).
The primary goals of the CCIEA are to better understand the web of interactions that drive patterns and trends of components within the California Current ecosystem, and forecast how changing environmental conditions and management actions affect the status of these components. The conceptual model of the social-ecological system of the California Current illustrates how humans and their social systems are inextricably linked to these marine, coastal, and upland environments (see https://www.integratedecosystemassessment.noaa.gov/regions/california-current/projects).

The over 300 indices developed for the CCSIEA are available through `rerddap`. Here an index of coho abundance in California is compared with the February value of an index of the strength and location of the North Pacific High, developed in "The North Pacific High and wintertime pre-conditioning of California current productivity" by Schroeder et al. (Geophys. Res. Lett., 40, 541–546).

Expand Down
133 changes: 67 additions & 66 deletions vignettes/rerddap.Rmd
@@ -1,7 +1,7 @@
---
title: rerddap introduction
author: Scott Chamberlain
date: "2022-02-05"
date: "2022-09-30"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{rerddap introduction}
Expand All @@ -26,26 +26,26 @@ When you use `griddap()` or `tabledap()` functions, we construct a MD5 hash from

## ERDDAP servers

You can get a data.frame of ERDDAP servers using the function `servers()`. The list of ERDDAP servers is drawn from the [Awesome ERDDAP site](https://irishmarineinstitute.github.io/awesome-erddap). If you know of more ERDDAP servers, follow the instructions on that page to add the server.
You can get a data.frame of ERDDAP servers using the function `servers()`. The list of ERDDAP servers is drawn from the *Awesome ERDDAP* page maintained by the Irish Marine Institute . If you know of more ERDDAP servers, follow the instructions on that page to add the server.

## Install

Stable version from CRAN


```r{cran_install, eval = FALSE, echo = TRUE}
```r
install.packages("rerddap")
```

Or, the development version from GitHub


```r{remote_install, eval = FALSE, echo = TRUE}
```r
remotes::install_github("ropensci/rerddap")
```


```r{load, eval = FALSE, echo = TRUE}
```r
library("rerddap")
```

Expand All @@ -54,56 +54,57 @@ library("rerddap")
First, you likely want to search for data, specify either `griddadp` or `tabledap`


```r{ed_search_table, eval = FALSE, echo = TRUE}
```r
ed_search(query = 'size', which = "table")
#> # A tibble: 42 × 2
#> title dataset_id
#> <chr> <chr>
#> 1 CCE Prey Size and Hard Part Size Regressions mmtdPreyS
#> 2 CCE Teleost Prey Size and Hard Part Size Measurements mmtdTeleo
#> 3 CalCOFI Larvae Sizes erdCalCOF
#> 4 Seabird Prey Size cciea_B_L
#> 5 CCE Non-Teleost Prey Size and Hard Part Size Measurements mmtdNonTe
#> 6 Channel Islands, Kelp Forest Monitoring, Size and Frequency, Natu… erdCinpKf
#> 7 File Names from the AWS S3 noaa-goes16 Bucket awsS3Noaa
#> 8 File Names from the AWS S3 noaa-goes17 Bucket awsS3Noaa
#> 9 NOAA-Navy Sanctuary Soundscapes Monitoring Project -- File Access noaaSanct
#> 10 PacIOOS Beach Camera 001: Waikiki, Oahu, Hawaii BEACHCAM-
#> # … with 32 more rows
#> # A tibble: 41 × 2
#> title datas…¹
#> <chr> <chr>
#> 1 CCE Prey Size and Hard Part Size Regressions mmtdPr
#> 2 CCE Teleost Prey Size and Hard Part Size Measurements mmtdTe
#> 3 CalCOFI Larvae Sizes erdCal
#> 4 Seabird Prey Size cciea_
#> 5 CCE Non-Teleost Prey Size and Hard Part Size Measurements mmtdNo
#> 6 Channel Islands, Kelp Forest Monitoring, Size and Frequency, Natural… erdCin
#> 7 File Names from the AWS S3 noaa-goes16 Bucket awsS3N
#> 8 File Names from the AWS S3 noaa-goes17 Bucket awsS3N
#> 9 PacIOOS Beach Camera 001: Waikiki, Oahu, Hawaii BEACHC
#> 10 PacIOOS Beach Camera 003: Waimea Bay, Oahu, Hawaii BEACHC
#> # … with 31 more rows, and abbreviated variable name ¹​dataset_id
```


```r{ed_search_grid, eval = FALSE, echo = TRUE}
```r
ed_search(query = 'size', which = "grid")
#> # A tibble: 101 × 2
#> title dataset_id
#> <chr> <chr>
#> 1 Audio data from a local source. testGridW
#> 2 Coastal Upwelling Transport Index (CUTI), Daily erdCUTIda
#> 3 Coastal Upwelling Transport Index (CUTI), Monthly erdCUTImo
#> 4 Biologically Effective Upwelling Transport Index (BEUTI), Daily erdBEUTId
#> 5 Biologically Effective Upwelling Transport Index (BEUTI), Monthly erdBEUTIm
#> 6 SST smoothed frontal gradients FRD_SSTgr
#> 7 SST smoothed frontal gradients, Lon0360 FRD_SSTgr
#> 8 Monthly means of OLR from interpolated OLR dataset (olr.mon.ltm),… noaa_psl_
#> 9 Chlorophyll, NOAA VIIRS-SNPP, Near Real-Time, Global, Level 3, 20… nesdisVHN
#> 10 Sardine Potential Habitat, MODIS Aqua Data, Near Real-Time, US We… sardine_h
#> # … with 91 more rows
#> # A tibble: 54 × 2
#> title datas…¹
#> <chr> <chr>
#> 1 Audio data from a local source. testGr
#> 2 Main Hawaiian Islands Multibeam Bathymetry Synthesis: 50-m Bathymetry hmrg_b
#> 3 Main Hawaiian Islands Multibeam Bathymetry Synthesis: 50-m Bathymetr… hmrg_b
#> 4 Coastal Upwelling Transport Index (CUTI), Daily erdCUT
#> 5 SST smoothed frontal gradients FRD_SS
#> 6 Coastal Upwelling Transport Index (CUTI), Monthly erdCUT
#> 7 SST smoothed frontal gradients, Lon0360 FRD_SS
#> 8 Biologically Effective Upwelling Transport Index (BEUTI), Daily erdBEU
#> 9 Biologically Effective Upwelling Transport Index (BEUTI), Monthly erdBEU
#> 10 monthly mean psi from the NCEP Reanalysis (psi.mon.ltm), 0001 noaa_p
#> # … with 44 more rows, and abbreviated variable name ¹​dataset_id
```

There is now a convenience function to search over a list of ERDDAP servers, designed to work with the function `servers()`


```r{global_search, eval = FALSE, echo = TRUE}
```r
global_search(query, server_list, which_service)
#> Error in check_arg(query, "character"): object 'query' not found
```

## Information

Then you can get information on a single dataset


```r{info_table, eval = FALSE, echo = TRUE}
```r
info('erdCalCOFIlrvsiz')
#> <ERDDAP info> erdCalCOFIlrvsiz
#> Base URL: https://upwell.pfeg.noaa.gov/erddap
Expand All @@ -123,13 +124,13 @@ info('erdCalCOFIlrvsiz')
First, get information on a dataset to see time range, lat/long range, and variables.


```r{info_grid, eval = FALSE, echo = TRUE}
```r
(out <- info('erdMBchla1day'))
#> <ERDDAP info> erdMBchla1day
#> Base URL: https://upwell.pfeg.noaa.gov/erddap
#> Dataset Type: griddap
#> Dimensions (range):
#> time: (2006-01-01T12:00:00Z, 2022-02-04T12:00:00Z)
#> time: (2006-01-01T12:00:00Z, 2022-09-28T12:00:00Z)
#> altitude: (0.0, 0.0)
#> latitude: (-45.0, 65.0)
#> longitude: (120.0, 320.0)
Expand All @@ -141,40 +142,40 @@ First, get information on a dataset to see time range, lat/long range, and varia
Then query for gridded data using the `griddap()` function


```r{griddap, eval = FALSE, echo = TRUE}
```r
(res <- griddap(out,
time = c('2015-01-01','2015-01-03'),
latitude = c(14, 15),
longitude = c(125, 126)
))
#> <ERDDAP griddap> erdMBchla1day
#> Path: [~/Library/Caches/R/rerddap/4d844aa48552049c3717ac94ced5f9b8.nc]
#> Last updated: [2022-02-05 16:01:53]
#> Last updated: [2022-09-30 09:34:02]
#> File size: [0.03 mb]
#> Dimensions (dims/vars): [4 X 1]
#> Dim names: time, altitude, latitude, longitude
#> Variable names: Chlorophyll Concentration in Sea Water
#> data.frame (rows/columns): [5043 X 5]
#> # A tibble: 5,043 × 5
#> time latitude longitude altitude chlorophyll
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 2015-01-01T12:00:00Z 14 125 0 NA
#> 2 2015-01-01T12:00:00Z 14 125. 0 NA
#> 3 2015-01-01T12:00:00Z 14 125. 0 NA
#> 4 2015-01-01T12:00:00Z 14 125. 0 NA
#> 5 2015-01-01T12:00:00Z 14 125. 0 NA
#> 6 2015-01-01T12:00:00Z 14 125. 0 NA
#> 7 2015-01-01T12:00:00Z 14 125. 0 NA
#> 8 2015-01-01T12:00:00Z 14 125. 0 NA
#> 9 2015-01-01T12:00:00Z 14 125. 0 NA
#> 10 2015-01-01T12:00:00Z 14 125. 0 NA
#> longitude latitude altitude time chlorophyll
#> <dbl> <dbl> <dbl> <chr> <dbl>
#> 1 125 14 0 2015-01-01T12:00:00Z NA
#> 2 125. 14 0 2015-01-01T12:00:00Z NA
#> 3 125. 14 0 2015-01-01T12:00:00Z NA
#> 4 125. 14 0 2015-01-01T12:00:00Z NA
#> 5 125. 14 0 2015-01-01T12:00:00Z NA
#> 6 125. 14 0 2015-01-01T12:00:00Z NA
#> 7 125. 14 0 2015-01-01T12:00:00Z NA
#> 8 125. 14 0 2015-01-01T12:00:00Z NA
#> 9 125. 14 0 2015-01-01T12:00:00Z NA
#> 10 125. 14 0 2015-01-01T12:00:00Z NA
#> # … with 5,033 more rows
```

The output of `griddap()` is a list that you can explore further. Get the summary


```r{grid_summary, eval = FALSE, echo = TRUE}
```r
res$summary
#> $filename
#> [1] "~/Library/Caches/R/rerddap/4d844aa48552049c3717ac94ced5f9b8.nc"
Expand All @@ -197,7 +198,7 @@ res$summary
Get the dimension variables


```r{grid_dimensions, eval = FALSE, echo = TRUE}
```r
names(res$summary$dim)
#> [1] "time" "altitude" "latitude" "longitude"
```
Expand All @@ -207,19 +208,19 @@ Get the data.frame (beware: you may want to just look at the `head` of the data.

```r
head(res$data)
#> time latitude longitude altitude chlorophyll
#> 1 2015-01-01T12:00:00Z 14 125.000 0 NA
#> 2 2015-01-01T12:00:00Z 14 125.025 0 NA
#> 3 2015-01-01T12:00:00Z 14 125.050 0 NA
#> 4 2015-01-01T12:00:00Z 14 125.075 0 NA
#> 5 2015-01-01T12:00:00Z 14 125.100 0 NA
#> 6 2015-01-01T12:00:00Z 14 125.125 0 NA
#> longitude latitude altitude time chlorophyll
#> 1 125.000 14 0 2015-01-01T12:00:00Z NA
#> 2 125.025 14 0 2015-01-01T12:00:00Z NA
#> 3 125.050 14 0 2015-01-01T12:00:00Z NA
#> 4 125.075 14 0 2015-01-01T12:00:00Z NA
#> 5 125.100 14 0 2015-01-01T12:00:00Z NA
#> 6 125.125 14 0 2015-01-01T12:00:00Z NA
```

## tabledap (tabular) data


```r{calcofi_info, eval = FALSE, echo = TRUE}
```r
(out <- info('erdCalCOFIlrvsiz'))
#> <ERDDAP info> erdCalCOFIlrvsiz
#> Base URL: https://upwell.pfeg.noaa.gov/erddap
Expand All @@ -235,12 +236,12 @@ head(res$data)
```


```r{calcofi_tabledap, eval = FALSE, echo = TRUE}
```r
(dat <- tabledap('erdCalCOFIlrvsiz', fields=c('latitude','longitude','larvae_size',
'scientific_name'), 'time>=2011-01-01', 'time<=2011-12-31'))
#> <ERDDAP tabledap> erdCalCOFIlrvsiz
#> Path: [~/Library/Caches/R/rerddap/db7389db5b5b0ed9c426d5c13bc43d18.csv]
#> Last updated: [2022-02-05 16:01:57]
#> Last updated: [2022-09-30 09:34:05]
#> File size: [0.05 mb]
#> # A tibble: 1,304 × 4
#> latitude longitude larvae_size scientific_name
Expand All @@ -261,7 +262,7 @@ head(res$data)
Since both `griddap()` and `tabledap()` give back data.frame's, it's easy to do downstream manipulation. For example, we can use `dplyr` to filter, summarize, group, and sort:


```r{calcofi_dplyr, eval = FALSE, echo = TRUE}
```r
library("dplyr")
dat$larvae_size <- as.numeric(dat$larvae_size)
dat %>%
Expand Down
2 changes: 1 addition & 1 deletion vignettes/rerddap.Rmd.og
Expand Up @@ -58,7 +58,7 @@ When you use `griddap()` or `tabledap()` functions, we construct a MD5 hash from

## ERDDAP servers

You can get a data.frame of ERDDAP servers using the function `servers()`. The list of ERDDAP servers is drawn from the [Awesome ERDDAP site](https://irishmarineinstitute.github.io/awesome-erddap). If you know of more ERDDAP servers, follow the instructions on that page to add the server.
You can get a data.frame of ERDDAP servers using the function `servers()`. The list of ERDDAP servers is drawn from the *Awesome ERDDAP* page maintained by the Irish Marine Institute . If you know of more ERDDAP servers, follow the instructions on that page to add the server.

## Install

Expand Down

0 comments on commit 5596054

Please sign in to comment.