Skip to content

Commit

Permalink
Merge branch 'develop' into sf
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelley committed Mar 7, 2020
2 parents 691ee39 + 2a0578b commit da24908
Show file tree
Hide file tree
Showing 200 changed files with 2,211 additions and 1,163 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: oce
Type: Package
Title: Analysis of Oceanographic Data
Version: 1.1-2
Version: 1.2-1
Authors@R: c(
person(given="Dan", family="Kelley", email="[email protected]", role=c("aut", "cre"), comment=c(ORCID="https://orcid.org/0000-0001-7808-5911")),
person(given="Clark", family="Richards", email="[email protected]", role=c("aut"), comment=c(ORCID="https://orcid.org/0000-0002-7833-206X")),
Expand Down
41 changes: 23 additions & 18 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
1.1-2

* accommodate new ocedata (needed to meet new CRAN dependency rule)
* add `oceRenameData()` and `oceRenamemetadata()`; deprecate `renameData()`
* improve axis control for `mapPlot()` and `plot,coastline-method`.
* remove `addColumn()`, `ctdAddColumn()`, `ctdUpdateHeader()`,
`findInOrdered()`, `mapMeridians()`, `mapZones()`, and `oce.as.POSIXlt()`,
all of which have been marked as "Deprecated" for the past two CRAN
releases.
* `read.met()` handle the new Environment Canada data format
* handle upcoming rgdal/R-devel changes
* `sectionSmooth()` detects grids that extend beyond data range
* `read.adp.rdi()` trims time vector if it exceeds other data lengths
* `geodDist()` defaults 2nd location correctly when `alongPath=FALSE`
* improve vignettes
* fix itemized-list documentation problem pointed out by Kurt Hornik
1.2-1
* FIXME: add changes here

1.2-0

* Address argument doc/code warning that blocked CRAN acceptance.
* Accommodate new ocedata (needed to meet new CRAN dependency rule).
* Add `oceRenameData()` and `oceRenamemetadata()`.
* Deprecate `renameData()`.
* Improve axis control for `mapPlot()` and `plot,coastline-method`.
* Remove `addColumn()`, `ctdAddColumn()`, `ctdUpdateHeader()`,
`findInOrdered()`, `mapMeridians()`, `mapZones()`, and
`oce.as.POSIXlt()`, all of which have been marked as
"Deprecated" for the past two CRAN releases.
* Make `read.met()` handle a new Environment Canada data format.
* Handle some upcoming rgdal/R-devel changes.
* Make `sectionSmooth()` detect grids extending beyond data range.
* Make `read.adp.rdi()` trim time if it longer than other data.
* Make `geodDist()` handle second location correctly when `alongPath=FALSE`.
* Improve vignettes.
* Fix itemized-list documentation problem pointed out by Kurt Hornik.

1.1-1

Expand Down Expand Up @@ -171,7 +176,7 @@
* swCSTp() added
* swConductivity() now swThermalConductivity(); using Caldwell (1974).
* many sw() functions handle eos="gsw"
* libary(gsw) replaces teos()
* library(gsw) replaces teos()
* curl() added
* handle new NOAA ascii topography dataset type
* mapGrid() added
Expand Down Expand Up @@ -666,7 +671,7 @@
* add undriftTime()
* add tdrPatm()
* make readTdr() gather serial no. info; show this on plot.pt()
* switch to recommended verion-number format
* switch to recommended version-number format
* remove section.subset(), replaced by subset()
* improve log items in functions that read and assemble oce objects
http://code.google.com/p/r-oce/issues/detail?id=38
Expand Down
2 changes: 1 addition & 1 deletion R/AllClass.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ setClass("satellite", contains="oce") # both amsr and landsat stem from this
#'
#' @param x a basic [oce-class] object,
#' but not from any subclass that derive from this base, because
#' subclases have their own plot methods, e.g. calling `plot()` on a
#' subclasses have their own plot methods, e.g. calling `plot()` on a
#' [ctd-class] object dispatches to [plot,ctd-method()].
#'
#' @param y Ignored; only present here because S4 object for generic `plot`
Expand Down
4 changes: 2 additions & 2 deletions R/adp.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
#' @family things related to adp data
setClass("adp", contains="oce")

#' ADP (acoustic-doppler profiler) dataset
#' Sample adp (acoustic-doppler profiler) dataset
#'
#' This is degraded subsample of measurements that were made with an
#' upward-pointing ADP manufactured by Teledyne-RDI, as part of the St Lawrence
Expand Down Expand Up @@ -1347,7 +1347,7 @@ read.adp <- function(file, from, to, by, tz=getOption("oceTz"),
}


#' Plot ADP Data
#' Plot an adp Object
#'
#' Create a summary plot of data measured by an acoustic doppler profiler.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/adp.rdi.R
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ decodeHeaderRDI <- function(buf, debug=getOption("oceDebug"), tz=getOption("oceT
#'
#' The following two-byte ID codes are recognized by `read.adp.rdi`
#' at this time (with bytes listed in natural order, LSB byte before
#' MSB). Items preceeded by an asterisk are recognized, but not handled,
#' MSB). Items preceded by an asterisk are recognized, but not handled,
#' and so produce a warning.
#'\tabular{rrrr}{
#' \tab **Byte 1** \tab **Byte 2** \tab **Meaning**\cr
Expand Down
3 changes: 2 additions & 1 deletion R/adp.sontek.R
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ read.adp.sontek.serial <- function(file, from=1, to, by=1, tz=getOption("oceTz")
type=c("adp", "pcadp"),
beamAngle=25, orientation,
monitor=FALSE, processingLog,
debug=getOption("oceDebug"))
debug=getOption("oceDebug"),
...)
{
if (!missing(file) && is.character(file) && 0 == file.info(file)$size)
stop("empty file")
Expand Down
4 changes: 2 additions & 2 deletions R/adv.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#' @family things related to adv data
setClass("adv", contains="oce")

#' ADV (acoustic-doppler velocimeter) dataset
#' Sample adv (acoustic-doppler velocimeter) dataset
#'
#' This [adv-class] object is a sampling of measurements made with a
#' Nortek Vector acoustic Doppler velocimeter deployed as part of the St Lawrence
Expand Down Expand Up @@ -387,7 +387,7 @@ read.adv <- function(file, from=1, to, by=1, tz=getOption("oceTz"),



#' Plot ADV data
#' Plot an adv Object
#'
#' Plot [adv-class] data.
#'
Expand Down
6 changes: 3 additions & 3 deletions R/amsr.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
#' 2. A simple interface for viewing and downloading data is at
#' `http://images.remss.com/amsr/amsr2_data_daily.html`.
#'
#' @seealso The documenation for the [landsat-class] class has
#' more informatoin on the handling data from the Landsat-8 satellite.
#' @seealso The documentation for the [landsat-class] class has
#' more information on the handling data from the Landsat-8 satellite.
#'
#' @family things related to amsr data
setClass("amsr", contains="satellite")
Expand Down Expand Up @@ -328,7 +328,7 @@ setMethod(f="subset",
#' @param x an [amsr-class] object.
#'
#' @param y String indicating the name of the band to plot; if not provided,
#' `SST` is used; see the documenation for the [amsr-class] class for a list of bands.
#' `SST` is used; see the documentation for the [amsr-class] class for a list of bands.
#'
#' @param asp Optional aspect ratio for plot.
#'
Expand Down
20 changes: 13 additions & 7 deletions R/argo.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,12 @@ setMethod(f="initialize",
return(.Object)
})

## a local function -- no need to pollute namespace with it
maybeLC <- function(s, lower)
if (lower) tolower(s) else s

getData <- function(file, name) # a local function -- no need to pollute namesapce with it
## a local function -- no need to pollute namespace with it
getData <- function(file, name, quiet=FALSE)
{
res <- NA
## wrap in capture.output to silence what seems like direct printing to stdout()
Expand All @@ -267,7 +269,8 @@ getData <- function(file, name) # a local function -- no need to pollute namesap
res <- try(ncdf4::ncvar_get(file, name), silent=TRUE)
})
if (inherits(res, "try-error")) {
warning(file$filename, " has no variable named '", name, "'\n", sep='')
if (!quiet)
warning(file$filename, " has no variable named '", name, "'\n", sep='')
res <- NULL
}
if (is.array(res) && 1 == length(dim(res))) res <- matrix(res) else res
Expand Down Expand Up @@ -1295,8 +1298,8 @@ read.argo <- function(file, debug=getOption("oceDebug"), processingLog, ...)
n <- item
d <- getData(file, maybeLC(n, lc))
varNames <- varNamesOmit(varNames, n)
oceDebug(debug-1, n, "\n")
oceDebug(debug-1, "A varNames=", paste(varNames, collapse=","), "\n")
oceDebug(debug, n, "\n")
oceDebug(debug, "varNames=", paste(varNames, collapse=","), "\n")
if (!is.null(d)) {
res@data[[argoNames2oceNames(n)]] <- d
res@metadata$dataNamesOriginal[[argoNames2oceNames(n)]] <- n
Expand All @@ -1305,7 +1308,10 @@ read.argo <- function(file, debug=getOption("oceDebug"), processingLog, ...)
}

n <- paste(item, maybeLC("_QC", lc), sep="")
d <- getData(file, maybeLC(n, lc))
oceDebug(debug, "about to try to get '", n, "' from netcdf file\n", sep="")
##if (n == "PRES_QC") browser()
d <- getData(file, maybeLC(n, lc), quiet=TRUE)
oceDebug(debug, "... got it\n", sep="")
varNames <- varNamesOmit(varNames, n)
oceDebug(debug-1, n, "\n")
oceDebug(debug-1, "B varNames=", paste(varNames, collapse=","), "\n")
Expand Down Expand Up @@ -1477,7 +1483,7 @@ as.argo <- function(time, longitude, latitude,
}


#' Plot Argo Data
#' Plot an argo Object
#'
#' Plot a summary diagram for argo data.
#'
Expand Down Expand Up @@ -1544,7 +1550,7 @@ as.argo <- function(time, longitude, latitude,
#' in the \CRANpkg{rgdal} package; this will be familiar to many readers as
#' the PROJ.4 notation; see [mapPlot()].
#'
#' @param mar value to be used with [par()]("mar").
#' @param mar value to be used with `par('mar')`.
#'
#' @param tformat optional argument passed to [oce.plot.ts()], for plot
#' types that call that function. (See [strptime()] for the format
Expand Down
2 changes: 1 addition & 1 deletion R/bremen.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ setMethod(f="[[<-",
callNextMethod(x=x, i=i, j=j, ...=..., value=value) # [[<-
})

#' Plot a Bremen Object
#' Plot a bremen Object
#'
#' Plot a [bremen-class] object.
#' If the first argument seems to be a CTD dataset, this uses [plot,ctd-method()];
Expand Down
2 changes: 1 addition & 1 deletion R/cm.R
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ read.cm.s4 <- function(file, from=1, to, by=1, tz=getOption("oceTz"),
}


#' Plot CM data
#' Plot a cm Object
#'
#' Creates a multi-panel summary plot of data measured by a current meter.
#'
Expand Down
13 changes: 5 additions & 8 deletions R/coastline.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ setMethod(f="[[<-",
#' @param subset An expression indicating how to subset `x`. See \dQuote{Details}.
#'
#' @param ... optional additional arguments, the only one of which is considered
#' is one named `debug`, an integer that controlls the level of debugging. If
#' is one named `debug`, an integer that controls the level of debugging. If
#' this is not supplied, `debug` is assumed to be 0, meaning no debugging. If
#' it is 1, the steps of determining the bounding box are shown. If it is 2 or larger,
#' then additional processing steps are shown, including the extraction of every
Expand Down Expand Up @@ -213,12 +213,9 @@ setMethod(f="subset",
options(warn=-1)
na <- which(is.na(cllon))
nseg <- length(na)
oceDebug(debug, "nseg=", nseg, "\n")
nnew <- 0
outlon <- NULL # FIXME: remove after transition to sf::
outlat <- NULL # FIXME: remove after transition to sf::
outlonSF <- NULL # FIXME: remove after transition to sf::
outlatSF <- NULL # FIXME: remove after transition to sf:"
##OLD nnew <- 0
outlon <- NULL
outlat <- NULL
for (iseg in 2:nseg) {
oceDebug(debug, "iseg=", iseg, "\n")
look <- seq.int(na[iseg-1]+1, na[iseg]-1)
Expand Down Expand Up @@ -311,7 +308,7 @@ as.coastline <- function(longitude, latitude, fillable=FALSE)
}


#' Plot a Coastline
#' Plot a coastline Object
#'
#' This function plots a coastline. An attempt is made to fill the space of
#' the plot, and this is done by limiting either the longitude range or the
Expand Down
10 changes: 5 additions & 5 deletions R/ctd.R
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ setMethod(f="summary",
#' slot. If it is impossible to determine the sampling time, then
#' `NULL` is returned. These time variants occur, in the
#' present version of oce, only for data read by [read.ctd.sbe()],
#' the documention of which explains how times are computed.
#' the documentation of which explains how times are computed.
#'
#' * `z`: Vertical coordinate in metres above the surface, computed with
#' [swZ]`(x)`.
Expand Down Expand Up @@ -2750,7 +2750,7 @@ write.ctd <- function(object, file, metadata=TRUE, flags=TRUE, format="csv")
}


#' Plot CTD Data
#' Plot a ctd Object
#'
#' Plot CTD data, by default in a four-panel display showing (a) profiles of
#' salinity and temperature, (b) profiles of density and the square of buoyancy
Expand Down Expand Up @@ -3781,10 +3781,10 @@ setMethod(f="plot",

#' Subset a CTD Object
#'
#' Return a subset of a section object.
#' Return a subset of a [ctd-class] object.
#'
#' This function is used to subset data within the
#' levels of a ctd object. There are two ways of working. If
#' This function is used to subset data within
#' a ctd object. There are two ways of working. If
#' `subset` is supplied, then it is a logical expression
#' that is evaluated within the environment of the `data`
#' slot of the object (see Example 1). Alternatively, if the
Expand Down
16 changes: 8 additions & 8 deletions R/ctd.sbe.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
#' `n2satumol/kg`\tab `nitrogenSaturation` \tab umol/kg \tab \cr
#' `nbin` \tab `nbin` \tab \tab \cr
#' `obsscufa~` \tab `backscatter` \tab NTU; Turner SCUFA \tab \cr
#' `opoxMg/L` \tab `oxygen` \tab mg/l; Optode, Anderaa\tab \cr
#' `opoxML/L` \tab `oxygen` \tab ml/l; Optode, Anderaa\tab \cr
#' `opoxMm/L` \tab `oxygen` \tab umol/l; Optode, Anderaa\tab \cr
#' `opoxPS` \tab `oxygen` \tab percent; Optode, Anderaa\tab \cr
#' `opoxMg/L` \tab `oxygen` \tab mg/l; Optode, Aanderaa\tab \cr
#' `opoxML/L` \tab `oxygen` \tab ml/l; Optode, Aanderaa\tab \cr
#' `opoxMm/L` \tab `oxygen` \tab umol/l; Optode, Aanderaa\tab \cr
#' `opoxPS` \tab `oxygen` \tab percent; Optode, Aanderaa\tab \cr
#' `oxsatML/L` \tab `oxygen` \tab ml/l; Weiss \tab \cr
#' `oxsatMg/L` \tab `oxygen` \tab mg/l; Weiss \tab \cr
#' `oxsatMm/Kg` \tab `oxygen` \tab umol/kg; Weiss \tab \cr
Expand Down Expand Up @@ -358,16 +358,16 @@ cnvName2oceName <- function(h, columns=NULL, debug=getOption("oceDebug"))
unit <- list(unit=expression(NTU), scale="Turner SCUFA")
} else if (1 == length(grep("^opoxMg/L$", name, useBytes=TRUE))) {
name <- "oxygen"
unit <- list(unit=expression(mg/l), scale="Optode, Anderaa")
unit <- list(unit=expression(mg/l), scale="Optode, Aanderaa")
} else if (1 == length(grep("^opoxML/L$", name, useBytes=TRUE))) {
name <- "oxygen"
unit <- list(unit=expression(ml/l), scale="Optode, Anderaa")
unit <- list(unit=expression(ml/l), scale="Optode, Aanderaa")
} else if (1 == length(grep("^opoxMm/L$", name, useBytes=TRUE))) {
name <- "oxygen"
unit <- list(unit=expression(mu*mol/l), scale="Optode, Anderaa")
unit <- list(unit=expression(mu*mol/l), scale="Optode, Aanderaa")
} else if (1 == length(grep("^opoxPS$", name, useBytes=TRUE))) {
name <- "oxygenSaturation"
unit <- list(unit=expression(percent), scale="Optode, Anderaa")
unit <- list(unit=expression(percent), scale="Optode, Aanderaa")
} else if (1 == length(grep("^oxsatML/L$", name, useBytes=TRUE))) {
name <- "oxygen"
unit <- list(unit=expression(ml/l), scale="Weiss")
Expand Down
2 changes: 1 addition & 1 deletion R/ctd.woce.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ woceUnit2oceUnit <- function(woceUnit)
#' This reads WOCE exchange files that start with the string `"CTD"`.
#' There are two variants: one in which the first 4 characters are
#' `"CTD,"` and the other in which the first 3 characters are
#' again `"CTD"` but no other non-whitespace characers occur on
#' again `"CTD"` but no other non-whitespace characters occur on
#' the line.
#'
#' @template readCtdTemplate
Expand Down
8 changes: 4 additions & 4 deletions R/echosounder.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#'
#' @details
#'
#' * An infrequently updated record of the intrument position, in
#' * An infrequently updated record of the instrument position, in
#' `timeSlow`, `longitudeSlow` and `latitudeSlow`. These are
#' used in plotting maps with [plot,echosounder-method()].
#'
Expand Down Expand Up @@ -332,7 +332,7 @@ setMethod(f="subset",
#' @param sourceLevel source level, in dB (uPa at 1m), denoted `sl` in
#' reference 1 p15, where it is in units 0.1dB (uPa at 1m)
#'
#' @param receiverSensitivity receiver sensivitity of the main element, in
#' @param receiverSensitivity receiver sensitivity of the main element, in
#' dB(counts/uPa), denoted `rs` in reference 1 p15, where it is in units of
#' 0.1dB(counts/uPa)
#'
Expand Down Expand Up @@ -432,7 +432,7 @@ findBottom <- function(x, ignore=5, clean=despike)
}


#' Plot Echosounder Data
#' Plot an echosounder Object
#'
#' Plot echosounder data.
#' Simple linear approximation is used when a `newx` value is specified
Expand Down Expand Up @@ -1092,7 +1092,7 @@ read.echosounder <- function(file, channel=1, soundSpeed,
if (debug > 1) cat(" comment tuple [1 sec 4.14 p28]\n")
## FIXME: other info could be gleaned from the comment, if needed
numbytes <- .C("uint16_le", buf[offset+34:35], 1L, res=integer(1), NAOK=TRUE, PACKAGE="oce")$res
if (debug > 1) cat('numbytes:', numbytes, ' ... NOTHING ELSE DECODED in this verion of oce.\n')
if (debug > 1) cat('numbytes:', numbytes, ' ... NOTHING ELSE DECODED in this version of oce.\n')
} else {
if (debug > 3) cat(" unknown code IGNORED\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/extdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
NULL


#' Sample RDI Teledyne adp dataset in format
#' Sample adp (acoustic-doppler profiler) file in RDI format
#'
#' @name adp_rdi.000
#'
Expand Down
2 changes: 1 addition & 1 deletion R/gps.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ setMethod(f="[[<-",
})


#' Plot a GPS Object
#' Plot a gps Object
#'
#' This function plots a gps object. An attempt is made to use the whole space
#' of the plot, and this is done by limiting either the longitude range or the
Expand Down
Loading

0 comments on commit da24908

Please sign in to comment.