dod.ctd.bbmp can retrieve both index files and data files from the Bedford Basin Mooring Project (BBMP). Since the naming convention of the data files may alter from year to year, it is important to start by downloading an index first, to ascertain the name of a file of interest; see ‘Examples’.
Usage
dod.ctd.bbmp(
year,
ID = NULL,
index = FALSE,
file = NULL,
destdir = ".",
age = 0,
debug = 0
)
Arguments
- year
a numeric or character value specifying the year of interest. If this is not provided, it defaults to the current year.
- ID
a character value specifying the file of interest that is copied from the index.
- index
a boolean value. If this is TRUE, then dod.ctd.bbmp downloads an index file that provides the names of files containing CTD data along with the sampling dates. The value of
ID
is ignored in this case. By contrast, ifindex
is FALSE, then dod.ctd.bbmp downloads the CTD file with the specifiedID
. See ‘Examples’.- file
character value giving the name to be used for the downloaded file. If this is NULL (which is the default) then the filename is as on the remote data server.
- destdir
a character value indicating the directory in which to store downloaded files.
- age
a numerical value indicating a time interval, in days. If the file to be downloaded from the server already exists locally, and was created less than
age
days in the past, it will not be downloaded again. Settingage=0
(which is the default) forces a download.- debug
an integer value indicating the level of debugging. If this exceeds 0, then some debugging messages will be printed. This value is passed down to related functions, but with 1 subtracted for each pass.
Value
dod.ctd.bbmp returns a character value naming the file that was retrieved. This may be either an index file or a data file; see the ‘Examples’ section for an example of a typical workflow.
See also
Other functions that download CTD data:
dod.ctd.bats()
,
dod.ctd.gtspp()
Examples
if (FALSE) {
# Download and study this year's first BBMP CTD file
library(dod)
# Download and read the index
indexFile <- dod.ctd("BBMP", index=TRUE)
index <- read.csv(indexFile, header=FALSE, col.names=c("file","time"), skip=3)
# Download the first file in the index
ctdFile <- dod.ctd("BBMP", ID=index$file[1])
# Use oce to read, summarize and plot the data.
library(oce)
ctd <- read.oce(ctdFile)
summary(ctd)
plot(ctd)
}