diff --git a/DESCRIPTION b/DESCRIPTION index c5109e8..0588e2c 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,8 @@ Package: rerddapXtracto Type: Package Title: Extracts Environmental Data from 'ERDDAP' Web Services -Version: 0.4.5 +Version: 0.4.6 +Date: 2020-01-08 Authors@R: person("Roy", "Mendelssohn", email = "roy.mendelssohn@noaa.gov", role = c("aut","cre")) Description: Contains three functions that access environmental data from any 'ERDDAP' data web service. The rxtracto() function extracts @@ -25,7 +26,7 @@ Imports: methods, ncdf4, parsedate, - plotdap, + plotdap (>= 0.0.5), readr, rerddap (>= 0.6.0), sf, @@ -38,7 +39,7 @@ Suggests: maptools, rgdal, rmarkdown -RoxygenNote: 6.1.1 +RoxygenNote: 7.0.2 Encoding: UTF-8 LazyData: TRUE VignetteBuilder: knitr diff --git a/NEWS.md b/NEWS.md index b0b5ad4..dfaecb9 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# rerddapXtracto 0.4.6 + +Changed vignette to work with latest version of 'plotdap' that now uses the colors from the 'cmocean' package + # rerddapXtracto 0.4.5 Added maptools and rgdal to Suggests to be consistent with of plotdap v0.0.4 diff --git a/R/plotBBox.R b/R/plotBBox.R index e2a57ee..1cfdb82 100644 --- a/R/plotBBox.R +++ b/R/plotBBox.R @@ -5,7 +5,7 @@ #' #' @export #' @param resp data frame returned from 'rxtracto()' -#' @param plotColor the color to use in plot from 'rerddap' +#' @param plotColor the color to use in plot from 'cmocean' #' @param time a function to map multi-time to one, or else identity #' for animation #' @param myFunc function of one argument to transform the data @@ -30,7 +30,7 @@ #' tcoord = tcoord, zcoord = zcoord) #' } #' # low resolution selected to keep time to render down -#' p <- plotBBox(MBsst, plotColor = 'temperature', maxpixels = 300) +#' p <- plotBBox(MBsst, plotColor = 'thermal', maxpixels = 300) plotBBox <- function(resp, plotColor = 'viridis', time = NA, myFunc = NA, mapData = NULL, crs = NULL, @@ -106,8 +106,8 @@ plotBBox <- function(resp, plotColor = 'viridis', time = NA, myFunc = NA, ggplot2::guides(fill = ggplot2::guide_colourbar(title = name))) } if (animate) { - xlim <- c(min(myStruct$longitude), max(myStruct$longitude)) - ylim <- c(min(myStruct$latitude), max(myStruct$latitude)) + xlim <- c(min(myStruct$data$lon), max(myStruct$data$lon)) + ylim <- c(min(myStruct$data$lat), max(myStruct$data$lat)) suppressMessages(myplot <- plotdap::add_ggplot( myplot, ggplot2::coord_sf( crs = myplot$crs, datum = myplot$datum, diff --git a/R/plotTrack.R b/R/plotTrack.R old mode 100644 new mode 100755 index f65dba8..2427d44 --- a/R/plotTrack.R +++ b/R/plotTrack.R @@ -7,7 +7,7 @@ #' @param ycoord passed to 'rxtracto()' #' @param tcoord passed to 'rxtracto()' #' @param resp data frame returned from 'rxtracto()' -#' @param plotColor the color to use in plot from 'rerddap' +#' @param plotColor the color to use in plot from 'cmocean' #' @param myFunc function of one argument to transform the data #' @param mapData map data from 'maps' or 'mapdata', must be of class 'map' #' @param crs valid crs string @@ -30,7 +30,7 @@ #' swchl <- rxtracto(swchlInfo, parameter = 'chlorophyll', xcoord = xpos, #' ycoord = ypos, tcoord = tpos, zcoord = zpos, xlen = .2, ylen = .2) #' } -#' p <- plotTrack(swchl, xpos, ypos, tpos, plotColor = 'chlorophyll') +#' p <- plotTrack(swchl, xpos, ypos, tpos, plotColor = 'algae') plotTrack <- function(resp, xcoord, ycoord, tcoord, plotColor = 'viridis', myFunc = NA, mapData = NULL, crs = NULL, diff --git a/cran-comments.md b/cran-comments.md index f975350..7e46b5b 100755 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,6 @@ -## update Version 0.4.5 +## update Version 0.4.6 -Minor update, added maptools and rgdal to Suggests to be consistent with plotdap v0.0.4. +Minor update so that the vignette is consistent with 'plotdap' version 0.0.5 ## Test environments diff --git a/data/cmocean.RData b/data/cmocean.RData deleted file mode 100644 index 0de1594..0000000 Binary files a/data/cmocean.RData and /dev/null differ diff --git a/man/cmocean.Rd b/man/cmocean.Rd deleted file mode 100644 index 61df79f..0000000 --- a/man/cmocean.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/cmocean.R -\docType{data} -\name{cmocean} -\alias{cmocean} -\title{cmocean colors -The cmocean color palette by Kristen Thyng} -\format{An object of class \code{list} of length 22.} -\usage{ -cmocean -} -\description{ -str(cmocean) -List of 22 -$ algae -$ amp -$ balance -$ curl -$ deep -$ delta -$ dense -$ diff -$ gray -$ haline -$ ice -$ matter -$ oxy -$ phase -$ rain -$ solar -$ speed -$ tarn -$ tempo -$ topo -$ thermal -$ turbid -} -\keyword{datasets} diff --git a/man/plotBBox.Rd b/man/plotBBox.Rd old mode 100644 new mode 100755 index dcad881..2e5249b --- a/man/plotBBox.Rd +++ b/man/plotBBox.Rd @@ -4,14 +4,23 @@ \alias{plotBBox} \title{plot result of 'rxtracto_3D'} \usage{ -plotBBox(resp, plotColor = "viridis", time = NA, myFunc = NA, - mapData = NULL, crs = NULL, animate = FALSE, cumulative = FALSE, - name = NA, maxpixels = 10000) +plotBBox( + resp, + plotColor = "viridis", + time = NA, + myFunc = NA, + mapData = NULL, + crs = NULL, + animate = FALSE, + cumulative = FALSE, + name = NA, + maxpixels = 10000 +) } \arguments{ \item{resp}{data frame returned from 'rxtracto()'} -\item{plotColor}{the color to use in plot from 'rerddap'} +\item{plotColor}{the color to use in plot from 'cmocean'} \item{time}{a function to map multi-time to one, or else identity for animation} @@ -50,5 +59,5 @@ MBsst <- rxtracto_3D(dataInfo, parameter, xcoord = xcoord, ycoord = ycoord, tcoord = tcoord, zcoord = zcoord) } # low resolution selected to keep time to render down -p <- plotBBox(MBsst, plotColor = 'temperature', maxpixels = 300) +p <- plotBBox(MBsst, plotColor = 'thermal', maxpixels = 300) } diff --git a/man/plotTrack.Rd b/man/plotTrack.Rd old mode 100644 new mode 100755 index 82ead8d..254318e --- a/man/plotTrack.Rd +++ b/man/plotTrack.Rd @@ -4,9 +4,21 @@ \alias{plotTrack} \title{plot result of 'rxtracto'} \usage{ -plotTrack(resp, xcoord, ycoord, tcoord, plotColor = "viridis", - myFunc = NA, mapData = NULL, crs = NULL, animate = FALSE, - cumulative = FALSE, name = NA, shape = 20, size = 0.5) +plotTrack( + resp, + xcoord, + ycoord, + tcoord, + plotColor = "viridis", + myFunc = NA, + mapData = NULL, + crs = NULL, + animate = FALSE, + cumulative = FALSE, + name = NA, + shape = 20, + size = 0.5 +) } \arguments{ \item{resp}{data frame returned from 'rxtracto()'} @@ -17,7 +29,7 @@ plotTrack(resp, xcoord, ycoord, tcoord, plotColor = "viridis", \item{tcoord}{passed to 'rxtracto()'} -\item{plotColor}{the color to use in plot from 'rerddap'} +\item{plotColor}{the color to use in plot from 'cmocean'} \item{myFunc}{function of one argument to transform the data} @@ -54,5 +66,5 @@ swchlInfo <- rerddap::info('erdSWchla8day') swchl <- rxtracto(swchlInfo, parameter = 'chlorophyll', xcoord = xpos, ycoord = ypos, tcoord = tpos, zcoord = zpos, xlen = .2, ylen = .2) } -p <- plotTrack(swchl, xpos, ypos, tpos, plotColor = 'chlorophyll') +p <- plotTrack(swchl, xpos, ypos, tpos, plotColor = 'algae') } diff --git a/man/rerddapXtracto.Rd b/man/rerddapXtracto.Rd old mode 100644 new mode 100755 index 2872608..5b3638e --- a/man/rerddapXtracto.Rd +++ b/man/rerddapXtracto.Rd @@ -3,7 +3,6 @@ \docType{package} \name{rerddapXtracto} \alias{rerddapXtracto} -\alias{rerddapXtracto-package} \title{rerddapXtracto: Routines to simplify data extraction using ERD's ERDDAP web service.} \description{ The rerddapXtracto package subsets and extracts satellite and other oceanographic related data diff --git a/man/rxtracto.Rd b/man/rxtracto.Rd old mode 100644 new mode 100755 index 7453850..4080fc9 --- a/man/rxtracto.Rd +++ b/man/rxtracto.Rd @@ -4,10 +4,22 @@ \alias{rxtracto} \title{Extract environmental data along a trajectory from an 'ERDDAP' server using 'rerddap'.} \usage{ -rxtracto(dataInfo, parameter = NULL, xcoord = NULL, ycoord = NULL, - zcoord = NULL, tcoord = NULL, xlen = 0, ylen = 0, zlen = 0, - xName = "longitude", yName = "latitude", zName = "altitude", - tName = "time", verbose = FALSE) +rxtracto( + dataInfo, + parameter = NULL, + xcoord = NULL, + ycoord = NULL, + zcoord = NULL, + tcoord = NULL, + xlen = 0, + ylen = 0, + zlen = 0, + xName = "longitude", + yName = "latitude", + zName = "altitude", + tName = "time", + verbose = FALSE +) } \arguments{ \item{dataInfo}{- the return from an 'rerddap::info' call to an 'ERDDAP' server} diff --git a/man/rxtracto_3D.Rd b/man/rxtracto_3D.Rd old mode 100644 new mode 100755 index 0e81815..eb3d09f --- a/man/rxtracto_3D.Rd +++ b/man/rxtracto_3D.Rd @@ -4,10 +4,20 @@ \alias{rxtracto_3D} \title{Extract environmental data in a 3-dimensional box from an 'ERDDAP' server using 'rerddap'.} \usage{ -rxtracto_3D(dataInfo, parameter = NULL, xcoord = NULL, ycoord = NULL, - zcoord = NULL, tcoord = NULL, xName = "longitude", - yName = "latitude", zName = "altitude", tName = "time", - verbose = FALSE, cache_remove = TRUE) +rxtracto_3D( + dataInfo, + parameter = NULL, + xcoord = NULL, + ycoord = NULL, + zcoord = NULL, + tcoord = NULL, + xName = "longitude", + yName = "latitude", + zName = "altitude", + tName = "time", + verbose = FALSE, + cache_remove = TRUE +) } \arguments{ \item{dataInfo}{- the return from an 'rerddap:info' call to an 'ERDDAP' server} diff --git a/man/rxtractogon.Rd b/man/rxtractogon.Rd old mode 100644 new mode 100755 index 12dfcbd..b5d4f0d --- a/man/rxtractogon.Rd +++ b/man/rxtractogon.Rd @@ -4,10 +4,20 @@ \alias{rxtractogon} \title{Extract environmental data in a polygon using 'ERDDAP' and 'rerddap'.} \usage{ -rxtractogon(dataInfo, parameter, xcoord = NULL, ycoord = NULL, - zcoord = NULL, tcoord = NULL, xName = "longitude", - yName = "latitude", zName = "altitude", tName = "time", - verbose = FALSE, cache_remove = TRUE) +rxtractogon( + dataInfo, + parameter, + xcoord = NULL, + ycoord = NULL, + zcoord = NULL, + tcoord = NULL, + xName = "longitude", + yName = "latitude", + zName = "altitude", + tName = "time", + verbose = FALSE, + cache_remove = TRUE +) } \arguments{ \item{dataInfo}{- the return from an 'rerddap:info' call to an 'ERDDAP' server} diff --git a/vignettes/UsingrerddapXtracto.Rmd b/vignettes/UsingrerddapXtracto.Rmd index 3f6c9c3..0cc3f2d 100755 --- a/vignettes/UsingrerddapXtracto.Rmd +++ b/vignettes/UsingrerddapXtracto.Rmd @@ -197,7 +197,7 @@ We plot the track line with the locations colored according to the mean of the s require("ggplot2") require("plotdap") -myPlot <- plotTrack(swchl1, xpos, ypos, tpos, plotColor = 'chlorophyll') +myPlot <- plotTrack(swchl1, xpos, ypos, tpos, plotColor = 'algae') myPlot ``` @@ -209,7 +209,7 @@ To make a cumulative animation of the track: ```{r animateTrack, echo = TRUE, eval = FALSE} -myPlot <- plotTrack(swchl1, xpos, ypos, tpos, plotColor = 'chlorophyll', +myPlot <- plotTrack(swchl1, xpos, ypos, tpos, plotColor = 'algae', animate = TRUE, cumulative = TRUE) ``` @@ -232,7 +232,7 @@ xlim <- c(-160, -105) topoInfo <- rerddap::info('etopo360') topo <- rxtracto(topoInfo, parameter = 'altitude', xcoord = xpos, ycoord = ypos, xlen = .1, ylen = .1) myFunc = function(x) -x -topoPlot <- plotTrack(topo, xpos, ypos, NA, plotColor = 'density', name = 'Depth', myFunc = myFunc) +topoPlot <- plotTrack(topo, xpos, ypos, NA, plotColor = 'dense', name = 'Depth', myFunc = myFunc) topoPlot ``` @@ -325,7 +325,7 @@ We can map the data using `plotBBox()`: require("ggplot2") require("plotdap") myFunc <- function(x) log(x) -chlalogPlot <- plotBBox(VIIRS, plotColor = 'chlorophyll', myFunc = myFunc) +chlalogPlot <- plotBBox(VIIRS, plotColor = 'algae', myFunc = myFunc) chlalogPlot ``` @@ -408,7 +408,7 @@ myFunc <- function(x) log(x) sanctchl1 <- sanctchl sanctchl1$chla <- sanctchl1$chla[, , 2] sanctchl1$time <- sanctchl1$time[2] -sanctchlPlot <- plotBBox(sanctchl1, plotColor = 'chlorophyll', myFunc = myFunc) +sanctchlPlot <- plotBBox(sanctchl1, plotColor = 'algae', myFunc = myFunc) sanctchlPlot ``` @@ -421,7 +421,7 @@ require("gganimate") require("ggplot2") require("plotdap") myFunc <- function(x) log(x) -sanctchlPlot <- plotBBox(sanctchl, plotColor = 'chlorophyll', myFunc = myFunc, time = identity, animate = TRUE) +sanctchlPlot <- plotBBox(sanctchl, plotColor = 'algae', myFunc = myFunc, time = identity, animate = TRUE) ``` ![Sanctuary Animation](sanctuary.gif) @@ -444,7 +444,7 @@ Mapping the data to show the canyon: require("ggplot2") require("mapdata") myFunc = function(x) -x -bathyPlot <- suppressMessages((plotBBox(bathy, plotColor = 'density', myFunc = myFunc, name = 'Depth'))) +bathyPlot <- suppressMessages((plotBBox(bathy, plotColor = 'dense', myFunc = myFunc, name = 'Depth'))) bathyPlot ``` @@ -470,7 +470,7 @@ str(soda70) ```{r soda70Plot, fig.width = 6, fig.height = 3, fig.align = 'center', warning = FALSE} require("ggplot2") require("plotdap") -sodaPlot <- plotBBox(soda70, plotColor = 'temperature', name = 'temp_at_70m', maxpixels = 30000) +sodaPlot <- plotBBox(soda70, plotColor = 'thermal', name = 'temp_at_70m', maxpixels = 30000) sodaPlot ``` @@ -497,7 +497,7 @@ NAtlSSS <- rxtracto_3D(dataInfo, parameter = parameter, xcoord = sssLons, ycoord ```{r NAtlSSSplot, eval = FALSE, echo = TRUE} require("ggplot2") require("plotdap") -NAtlSSSPlot <- plotBBox(NAtlSSS, plotColor = 'salinity', name = "salinity", maxpixels = 30000) +NAtlSSSPlot <- plotBBox(NAtlSSS, plotColor = 'haline', name = "salinity", maxpixels = 30000) NAtlSSSPlot ``` @@ -537,8 +537,8 @@ Plotting the results using `plotBBox()`: ```{r ifrPSALplot, fig.width = 6, fig.height = 3, fig.align='center', warning = FALSE} require("ggplot2") require("plotdap") -ifrPSALPlot <- plotBBox(ifrPSAL, plotColor = 'salinity', name = "salinity", maxpixels = 30000) -print(ifrPSALPlot) +ifrPSALPlot <- plotBBox(ifrPSAL, plotColor = 'haline', name = "salinity", maxpixels = 30000) +ifrPSALPlot ```