This prints an overview of the variables in a NetCDF file, along with time, longitude and latitude, if the last three are stored as dimensions.
Usage
netcdfTOC(file, level = 1L, debug = getOption("oceDebug"))
Arguments
- file
character value naming a NetCDF file.
- level
integer indicating the level of the overview. If
level
is 1, which is the default, then a list holding the names of variables and dimensions is printed (and returned, silently). Iflevel
is 2, then more information is printed.- debug
an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many
oce
functions. Generally, settingdebug=0
turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value ofdebug
first, so that a user can often obtain deeper debugging by specifying higherdebug
values.
Value
If level
is 1, then the printed list of variables and dimensions
is returned. Otherwise, more information is printed, but
the return value is the same as for level
1.
Details
An alternative to this is to examine what is printed by running
ncdf4::nc_open()
with the given filename, but this output can be a bit
confusing to read, especially for files that have voluminous global
attributes.
Examples
library(oce)
# Saving to a temporary file for CRAN testing; in practice,
# it's more likely that the user will retain this file, or already
# have a target file on the local system.
if (requireNamespace("ncdf4") &&
requireNamespace("jsonlite") &&
requireNamespace("curl")) {
urlroot <- "ftp://ftp.ifremer.fr/ifremer/argo/dac/bodc/6900388/profiles/"
remotefile <- "D6900388_001.nc"
localfile <- tempfile(fileext = ".nc")
curl::curl_download(paste0(urlroot, remotefile), localfile)
netcdfTOC(localfile)
unlink(localfile)
}
#> Loading required namespace: ncdf4
#> Loading required namespace: curl