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, using dod.ctd.bbmp.index first, to determine a file of interest; see ‘Examples’.
Usage
dod.ctd.bbmp(
year,
ID = NULL,
direction = "DN",
server = paste0("https://cioosatlantic.ca/erddap/files/",
"bio_atlantic_zone_monitoring_program_ctd/",
"Bedford%20Basin%20Monitoring%20Program"),
file = NULL,
destdir = ".",
age = 0,
quiet = FALSE,
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 indicating the station name. This is usually in a form like
001_1
, but for some years also have some profiles with IDs like001_01
, as well as001_1
. Usingdod.ctd.bbmp.index()
to discover IDs usually works, but if that fails, explore the webserver defined by theserver
parameter, to check.- direction
a character value indicating the direction of the cast, either
"DN"
(the default) or"UP"
.- server
character value indicating the base name of the server. This may change over time.
- 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
forces a download, so that existing files will always be updated. By contrast, settingage
to a negative number prevents the updating of files that already exist locally, regardless of their age.- quiet
a logical value, passed to
curl::curl_download()
, which does the downloading. If this is TRUE (the default), then the work is done quietly. Until version version 0.1.12, this parameter was calledsilent
, but it was renamed to match the corresponding argument incurl::curl_download()
, which may be more familiar to users.- 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. See the ‘Examples’ section for an example of a typical workflow.
Historical Note
Sometime in prior to April 2025, the DFO server and the format
of the data files both changed, and this necessitated changes
to dod.ctd.bbmp()
. Also, for clarity of use, the new
function dod.ctd.bbmp.index()
was added then.
See also
Other functions that download files:
dod.amsr()
,
dod.buoy()
,
dod.coastline()
,
dod.ctd()
,
dod.ctd.bats()
,
dod.ctd.gtspp()
,
dod.ctd.itp()
,
dod.met()
,
dod.tideGauge()
,
dod.topo()
Examples
# Download and study first BBMP CTD file of year 2024
if (interactive()) { # sidestep a pkgdown::build_site() error
library(dod)
# Note: cannot specify year=2025 because the URL is differently constructed
index <- dod.ctd.bbmp.index(year = "2024")
destdir <- tempdir() # get temporary storage
ctdFile <- dod.ctd("BBMP",
year = index$year[1], ID = index$ID[1],
direction = "DN", destdir = destdir
)
# Use oce to read, summarize and plot the data.
library(oce)
ctd <- read.netcdf(ctdFile) |>
rename() |>
as.ctd()
summary(ctd)
plot(ctd)
unlink(destdir, recursive = TRUE) # clean up temporary storage
}