Skip to content

Commit

Permalink
remove some trailing whitespace in code
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelley committed Aug 11, 2018
1 parent 83c5adb commit c2d3cab
Show file tree
Hide file tree
Showing 35 changed files with 81 additions and 82 deletions.
2 changes: 1 addition & 1 deletion R/AllClass.R
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ setFlagsInternal <- function(object, name=NULL, i=NULL, value=NULL, debug=getOpt
## Ensure proper argument setup.
if (is.null(name))
stop("must supply a name")
if (is.null(i))
if (is.null(i))
stop("must supply 'i'")
if (is.null(value))
stop("must supply 'value'")
Expand Down
8 changes: 4 additions & 4 deletions R/adp.R
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ setMethod(f="summary",
## 20170107: drop the printing of these. In the new scheme, we can subsample
## 20170107: files, and therefore do not read to the end, and it seems silly
## 20170107: to use time going through the whole file to find this out. If we
## 20170107: decide that this is needed, we could do a seek() to the end of the
## 20170107: decide that this is needed, we could do a seek() to the end of the
## 20170107: and then go back to find the final time.

## cat(sprintf("* Measurements: %s %s to %s %s sampled at %.4g Hz\n",
Expand Down Expand Up @@ -3146,15 +3146,15 @@ binmapAdp <- function(x, debug=getOption("oceDebug"))
#' averaging during post-processing, thereby reducing the overall
#' size of the data set and decreasing the uncertainty of the
#' velocity estimates (by averaging out Doppler noise).
#'
#'
#' @param x an \code{adp} object, i.e. one inheriting from \code{\link{adp-class}}.
#' @param n number of pings to average together.
#' @param leftover a logical value indicating how to proceed in cases
#' where \code{n} does not divide evenly into the number of ensembles
#' in \code{x}. If \code{leftover} is \code{FALSE} (the default) then any extra
#' ensembles at the end of \code{x} are ignored. Otherwise, they are used
#' to create a final ensemble in the returned value.
#' @param na.rm a logical value indicating whether NA values should be stripped
#' @param na.rm a logical value indicating whether NA values should be stripped
#' before the computation proceeds
#' @param ... extra arguments to be passed to the \code{mean()} function.
#'
Expand All @@ -3166,7 +3166,7 @@ binmapAdp <- function(x, debug=getOption("oceDebug"))
#' data(adp)
#' adpAvg <- adpEnsembleAverage(adp, n=2)
#' plot(adpAvg)
#'
#'
#' @family things related to \code{adp} data
adpEnsembleAverage <- function(x, n=5, leftover=FALSE, na.rm=TRUE, ...)
{
Expand Down
10 changes: 5 additions & 5 deletions R/air.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' Wind dataset
#'
#'
#' Wind data inferred from Figure 5 of Koch et al. (1983), provided to
#' illustrate the \code{\link{interpBarnes}} function.
#' Columns \code{wind$x} and \code{wind$y} are location, while \code{wind$z} is
#' the wind speed, in m/s.
#'
#'
#' @name wind
#' @docType data
#'
Expand All @@ -16,13 +16,13 @@ NULL


#' Air density
#'
#'
#' Compute, \eqn{\rho}{rho}, the \emph{in-situ} density of air.
#'
#'
#' This will eventually be a proper equation of state, but for now it's just
#' returns something from wikipedia (i.e. not trustworthy), and not using
#' humidity.
#'
#'
#' @param temperature \emph{in-situ} temperature [\eqn{^\circ}{deg}C]
#' @param pressure pressure in Pa (NOT kPa) -- ignored at present
#' @param humidity ignored at present
Expand Down
12 changes: 6 additions & 6 deletions R/argo.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ setClass("argo", contains="oce")
#' @source This file was downloaded using the unix command
#'\preformatted{
#' ftp ftp://ftp.ifremer.fr/ifremer/argo/dac/bodc/6900388/6900388_prof.nc
#'} issued on 2017 July 7.
#'} issued on 2017 July 7.
#'
#' @family datasets provided with \code{oce}
#' @family things related to \code{argo} data
Expand All @@ -79,7 +79,7 @@ NULL
#'
#' There are several possibilities, depending on the nature of \code{i}.
#'\itemize{
#' \item If \code{i} is the string \code{"SA"}, then
#' \item If \code{i} is the string \code{"SA"}, then
#' Absolute Salinity is computed using \code{\link[gsw]{gsw_SA_from_SP}},
#' with \code{salinityAdjusted} (etc) if available in the \code{data}
#' slot of \code{x}, otherwise using \code{salinity} (etc).
Expand Down Expand Up @@ -195,23 +195,23 @@ getData <- function(file, name) # a local function -- no need to pollute namesap
#' Convert Argo Data Name to Oce Name
#'
#' This function is used internally by \code{\link{read.argo}} to convert Argo-convention
#' data names to oce-convention names. Users should not call this directly, since
#' data names to oce-convention names. Users should not call this directly, since
#' its return value may be changed at any moment (e.g. to include units as well
#' as names).
#'
#'
#'
#' The inference of names was done
#' by inspection of some data files, using [1] as a reference. It should be noted,
#' however, that the data files examined contain some names that are not
#' undocumented in [1], and others that are listed only in its changelog,
#' undocumented in [1], and others that are listed only in its changelog,
#' with no actual definitions being given. For example, the files had six distinct
#' variable names that seem to relate to phase in the oxygen sensor, but
#' these are not translated by the present function because these
#' variable names are not defined in [1], or not defined uniquely
#' in [2].
#'
#' The names are converted with
#' \code{\link{gsub}}, using the \code{ignore.case} argument of the present
#' \code{\link{gsub}}, using the \code{ignore.case} argument of the present
#' function.
#' The procedure
#' is to first handle the items listed in the following table, with string
Expand Down
2 changes: 1 addition & 1 deletion R/cm.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ as.cm <- function(time, u=NULL, v=NULL,
#' @return An object of \code{\link{cm-class}}.
#' The \code{data} slot will contain all the data in the file, with names
#' determined from the tokens in line 3 in that file, passed through
#' \code{\link{make.names}}, except that
#' \code{\link{make.names}}, except that
#' \code{Vnorth} is renamed \code{v} (after conversion from cm/s to m/s),
#' \code{Veast} is renamed \code{u} (after conversion from cm/s to m/s),
#' \code{Cond} is renamed \code{conductivity},
Expand Down
4 changes: 2 additions & 2 deletions R/coastline.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ setClass("coastline", contains="oce")
#' startup file.
#' @author Dan Kelley
#' @source Downloaded from \url{http://www.naturalearthdata.com}, in
#' \code{ne_110m_admin_0_countries.shp} in July 2015, with an
#' \code{ne_110m_admin_0_countries.shp} in July 2015, with an
#' update on December 16, 2017.
#' @family datasets provided with \code{oce}
#' @family things related to \code{coastline} data
Expand Down Expand Up @@ -651,7 +651,7 @@ setMethod(f="plot",
ylabels <- formatPosition(yr.pretty, isLat=TRUE, type='expression',
showHemi=geographical==3)
}

axis(1, at=xr.pretty, labels=xlabels, pos=usrTrimmed[3], cex.axis=cex.axis)
oceDebug(debug, "putting bottom x axis at", usrTrimmed[3], "with labels:", xlabels, "\n")
axis(2, at=yr.pretty, labels=ylabels, pos=usrTrimmed[1], cex.axis=cex.axis, cex=cex.axis)
Expand Down
2 changes: 1 addition & 1 deletion R/ctd.R
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ setMethod(f="[[",
if (!(j %in% c("", "ratio", "uS/cm", "mS/cm", "S/m")))
stop("unknown conductivity unit \"", unit, "\"; must be \"\", \"ratio\", \"uS/cm\", \"mS/cm\" or \"S/m\"")
if (j == "")
j <- "ratio" # lets us use switch()
j <- "ratio" # lets us use switch()
unit <- x@metadata$units$conductivity$unit
if (is.null(unit) || !length(unit)) {
## FIXME: maybe should look at median value, to make a guess
Expand Down
2 changes: 1 addition & 1 deletion R/ctd.itp.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ read.ctd.itp <- function(file, columns=NULL, station=NULL, missingValue, monitor
unit <- gsub("(.*)\\((.*)\\)", "\\2", tokens[i])
if (unit == "umol/kg")
units[[names[i]]] <- list(unit=expression(mu*mol/kg), scale="")
else
else
units[[names[i]]] <- list(unit=expression(unit), scale="")
} else if (names[i] != "year" && names[i] != "day") {
unit <- gsub("(.*)\\((.*)\\)", "\\2", tokens[i])
Expand Down
2 changes: 1 addition & 1 deletion R/ctd.odf.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' The ODF format, used by the Canadian Department of Fisheries and Oceans, is
#' described to some extent in the documentation for \code{\link{read.odf}}. It
#' is not clear that ODF format is handled correctly in \code{read.ctd.odf}, or
#' the more general function \code{\link{read.odf}}, because the format
#' the more general function \code{\link{read.odf}}, because the format
#' varies between some sample files the author has encountered in his research.
#' @family things related to \code{ctd} data
#' @family things related to \code{odf} data
Expand Down
2 changes: 1 addition & 1 deletion R/ctd.sbe.R
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ read.ctd.sbe <- function(file, columns=NULL, station=NULL, missingValue,
if (0 < (r<-regexpr("station:", lline)))
station <- sub("[ ]*$", "", sub("(.*)station:([ ])*", "", ignore.case=TRUE, line))
if (0 < (r<-regexpr("station_name:", lline)))
station <- sub("[ ]*$", "", sub("(.*)station_name:([ ])*", "", ignore.case=TRUE, line))
station <- sub("[ ]*$", "", sub("(.*)station_name:([ ])*", "", ignore.case=TRUE, line))
}
if (0 < (r<-regexpr("recovery:", lline)))
recovery <- sub("(.*)recovery:([ ])*", "", lline)
Expand Down
6 changes: 3 additions & 3 deletions R/ctd.woce.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ oceNames2whpNames <- function(names)

#' Translate oce unit to WHP unit
#'
#' Translate oce units to WHP-style strings,
#' Translate oce units to WHP-style strings,
#' to match patterns. For example, the pattern \code{"oxygen"}
#' is taken to mean \code{"CTDOXY"}.
#'
Expand Down Expand Up @@ -198,7 +198,7 @@ woceNames2oceNames <- function(names)
#' @family things related to \code{ctd} data
#' @family functions that interpret variable names and units from headers
woceUnit2oceUnit <- function(woceUnit)
{
{
## message("woceUnit2oceUnit(\"", woceUnit, "\")", sep="")
if (woceUnit == "DB" || woceUnit == "DBAR")
return(list(unit=expression(dbar), scale=""))
Expand Down Expand Up @@ -706,7 +706,7 @@ read.ctd.woce.other <- function(file, columns=NULL, station=NULL, missingValue,
if (length(names) == length(units)) {
n <- length(names)
## example
## "DBAR" "ITS-90" "PSS-7" "UMOL/KG" "V" "V" "OBS." "*"
## "DBAR" "ITS-90" "PSS-7" "UMOL/KG" "V" "V" "OBS." "*"
for (i in 1:n) {
if (units[i] == "DBAR") {
res@metadata$units[[names[i]]] <- list(unit=expression(dbar), scale="")
Expand Down
4 changes: 2 additions & 2 deletions R/echosounder.R
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ read.echosounder <- function(file, channel=1, soundSpeed,
c <- matrix(NA_real_, nrow=1, ncol=1)
## FIXME: find out whether samplesPerPing is always defined prior to use in the code1==0x15 blocks.
## The Rstudio code-diagnostic complains that this variable is used before being defined,
## but when I run test code there is no problem, because the variable has been defined. What I
## but when I run test code there is no problem, because the variable has been defined. What I
## do *not* know is whether files will always have these byte groupsing in this order, but at
## least setting to a zero value is likely to cause an error, if that ever occurs. (I may just
## need to reorder some code, if problems arise.)
Expand Down Expand Up @@ -1017,7 +1017,7 @@ read.echosounder <- function(file, channel=1, soundSpeed,
res@metadata$fileType <- fileType
res@metadata$blankedSamples <- blankedSamples
if (missing(soundSpeed)) {
res@metadata$soundSpeed <- swSoundSpeed(35, 10, 30, eos="unesco")
res@metadata$soundSpeed <- swSoundSpeed(35, 10, 30, eos="unesco")
} else {
res@metadata$soundSpeed <- soundSpeed
}
Expand Down
2 changes: 1 addition & 1 deletion R/imagep.R
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ imagep <- function(x, y, z,
zlim <- c(-1, 1) * max(abs(z), na.rm=TRUE)
}
}

zlimHistogram <- zlimGiven && zlim == "histogram"
breaksGiven <- !missing(breaks)
colormapGiven <- !missing(colormap)
Expand Down
14 changes: 7 additions & 7 deletions R/index.R
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#' Read a NOAA ocean index file
#'
#'
#' Read an ocean index file, in the format used by NOAA.
#'
#'
#' @details
#' Reads a text-format index file, in either of two formats. If
#' Reads a text-format index file, in either of two formats. If
#' \code{format} is missing, then the first line of the file is examined. If
#' that line contains 2 (whitespace-separated) tokens, then \code{"noaa"}
#' format is assumed. If it contains 13 tokens, then \code{"ucar"} format is assumed.
#' Otherwise, an error is reported.
#'
#' In the \code{"noaa"} format, the two tokens on the first line are taken to
#' In the \code{"noaa"} format, the two tokens on the first line are taken to
#' be the start year and the end year, respectively. The second line
#' must contain a single token, the missing value. All further lines must contain
#' 12 tokens, for the values in January, February, etc.
#'
#' In the \code{"ucar"} format, all data lines must contain the 13 tokens,
#' the first of which is the year, with the following 12 being the values
#' for January, February, etc.
#'
#'
#' @param file a connection or a character string giving the name of the file
#' to load. May be a URL.
#' @param format optional character string indicating the format type. If not
#' supplied, a guess will be made, based on examination of the first few lines
#' of the file. If supplied, the possibilities are \code{"noaa"} and
#' of the file. If supplied, the possibilities are \code{"noaa"} and
#' \code{"ucar"}. See \dQuote{Details}.
#' @param missingValue If supplied, this is a numerical value that indicates
#' invalid data. In some datasets, this is -99.9, but other values may be used.
Expand All @@ -40,7 +40,7 @@
#' @references See \url{https://www.esrl.noaa.gov/psd/data/climateindices/list/}
#' for a list of indices.
#' @examples
#'
#'
#' \dontrun{
#' library(oce)
#' par(mfrow=c(2, 1))
Expand Down
2 changes: 1 addition & 1 deletion R/lobo.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ setMethod(f="plot",
oce.plot.ts(x[["time"]], x[["salinity"]], ylab=resizableLabel("S"), debug=debug-1, ...)
} else if (w == 3) {
if (any(!is.na(x[['pressure']]))) {
plotTS(as.ctd(x[["salinity"]], x[["temperature"]], x[["pressure"]]), eos="unesco", debug=debug-1, ...)
plotTS(as.ctd(x[["salinity"]], x[["temperature"]], x[["pressure"]]), eos="unesco", debug=debug-1, ...)
} else {
plotTS(as.ctd(x[["salinity"]], x[["temperature"]], 0), eos="unesco", debug=debug-1, ...)
}
Expand Down
3 changes: 1 addition & 2 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -3186,8 +3186,7 @@ coriolis <- function(latitude, degrees=TRUE)
{
## Siderial day 86164.1 s.
if (degrees) latitude <- latitude * 0.0174532925199433
## http://www.iag-aig.org/attach/e354a3264d1e420ea0a9920fe762f2a0/51-groten.pdf
7292115e-11
## http://www.iag-aig.org/attach/e354a3264d1e420ea0a9920fe762f2a0/51-groten.pdf 7292115e-11
2 * 7292115e-11 * sin(latitude)
}

Expand Down
2 changes: 1 addition & 1 deletion R/oce.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ as.oce <- function(x, ...)
##DELETE for (i in seq_len(ndots))
##DELETE if (!inherits(dots[[i]], "oce"))
##DELETE stop("concatenate() argument ", i, " does not inherit from \"oce\"")
##DELETE
##DELETE
##DELETE ## Concatenate the data (and flags, if there are such).
##DELETE res <- dots[[1]]
##DELETE n1 <- sort(names(dots[[1]]@data))
Expand Down
4 changes: 2 additions & 2 deletions R/odf.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ setMethod(f="plot",
data <- x@data
dataNames <- names(data)
## At the start, n is the number of non-time variables, but
## later on we might switch it to equal nok, which is the
## later on we might switch it to equal nok, which is the
## number of non-time variables that contain finite data.
if (!("time" %in% dataNames)) {
finite <- unlist(lapply(data, function(col) any(is.finite(col))))
Expand All @@ -181,7 +181,7 @@ setMethod(f="plot",
N <- as.integer(0.5 + sqrt(n - 1))
M <- as.integer(n / N)
## may need to add 1, but use a loop in case my logic is mixed up
## if that would
## if that would
while (N * M < n)
M <- M + 1
par(mfrow=c(N, M))
Expand Down
10 changes: 5 additions & 5 deletions R/run.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' Calculate running linear models
#'
#'
#' The linear model is calculated from the slope of a localized least-squares
#' regression model y=y(x). The localization is defined by the x difference
#' from the point in question, with data at distance exceeding L/2 being
Expand All @@ -8,7 +8,7 @@
#' weighting function is used; the latter produces smoother derivatives, which
#' can be useful for noisy data. The function is based on internal
#' calculation, not on \code{\link{lm}}.
#'
#'
#' @param x a vector holding x values.
#' @param y a vector holding y values.
#' @param xout optional vector of x values at which the derivative is to be
Expand All @@ -25,9 +25,9 @@
#' returned, and if \code{deriv=1}, a vector of derivatives is returned.
#' @author Dan Kelley
#' @examples
#'
#'
#' library(oce)
#'
#'
#' # Case 1: smooth a noisy signal
#' x <- 1:100
#' y <- 1 + x/100 + sin(x/5)
Expand All @@ -37,7 +37,7 @@
#' plot(x, y, type='l', lwd=7, col='gray')
#' points(x, yn, pch=20, col='blue')
#' lines(x, calc$y, lwd=2, col='red')
#'
#'
#' # Case 2: square of buoyancy frequency
#' data(ctd)
#' par(mfrow=c(1,1))
Expand Down
6 changes: 3 additions & 3 deletions R/section.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ setMethod(f="initialize",
#' @title Handle flags in Section Objects
#'
#' @details
#' The default for \code{flags} is based on
#' The default for \code{flags} is based on
#' calling \code{\link{defaultFlags}} based on the
#' \code{metadata} in the first station in the section. If the
#' other stations have different flag schemes (which seems highly
Expand Down Expand Up @@ -2365,7 +2365,7 @@ read.section <- function(file, directory, sectionId="", flags,
#' @param method The method to use to decimate data within the stations; see
#' \code{\link{ctdDecimate}}, which is used for the decimation.
#'
#' @template debugTemplate
#' @template debugTemplate
#'
#' @param ... Optional arguments to be supplied to \code{\link{ctdDecimate}},
#' e.g. \code{rule} controls extrapolation beyond the observed pressure range,
Expand Down Expand Up @@ -2426,7 +2426,7 @@ sectionGrid <- function(section, p, method="approx", debug=getOption("oceDebug")
"Removed flags from gridded section object. Use handleFlags() first to remove bad data.")
for (i in 1:n) {
##message("i: ", i, ", p before decimation: ", paste(section@data$station[[i]]@data$pressure, " "))
suppressWarnings(res@data$station[[i]] <- ctdDecimate(section@data$station[[i]], p=pt, method=method,
suppressWarnings(res@data$station[[i]] <- ctdDecimate(section@data$station[[i]], p=pt, method=method,
debug=debug-1, ...))
res@data$station[[i]]@metadata$flags <- NULL
##message("i: ", i, ", p after decimation: ", paste(res@data$station[[i]]@data$pressure, " "))
Expand Down
Loading

0 comments on commit c2d3cab

Please sign in to comment.