This works with either a vector of NetCDF files, or a argoFloats object of type "profiles", as created by getProfiles(). During the reading, argo profile objects are created with oce::read.argo() or a replacement function provided as the FUN argument.

readProfiles(
  profiles,
  FUN,
  destdir = argoDefaultDestdir(),
  quiet = FALSE,
  debug = 0
)

Arguments

profiles

either (1) a character vector that holds the names of NetCDF files or (2) an argoFloats object created by getProfiles(). In the first case, any items that start with "ftp:" are taken to represent the full paths to remote files, and these first downloaded to the destdir directory using getProfileFromUrl().

FUN

a function that reads the NetCDF files in which the argo profiles are stored. If FUN not provided, then it defaults to oce::read.argo(). Only experts should consider anything other than this default, or a wrapper to it.

destdir

character value indicating the directory in which to store downloaded files. The default value is to compute this using argoDefaultDestdir(), which returns ~/data/argo by default, although it also provides ways to set other values using options(). Set destdir=NULL if destfile is a filename with full path information. File clutter is reduced by creating a top-level directory called data, with subdirectories for various file types; see “Examples”.

quiet

logical value; use FALSE to show more verbose information when downloading files. (Even if quiet is TRUE, problems will still be reported.)

debug

an integer specifying the level of debugging. If this is zero, the work proceeds silently. If it is 1, a small amount of debugging information is printed. Note that debug-1 is passed to oce::read.argo(), which actually reads the file, and so it will print messages if debug exceeds 1.

Value

An argoFloats object with type="argos", in which the data slot contains a list named argos that holds objects that are created by oce::read.argo().

Details

By default, warnings are issued about any profiles in which 10 percent or more of the measurements are flagged with a quality-control code of 0, 3, 4, 6, 7, or 9 (see the applyQC() documentation for the meanings of these codes). For more on this function, see section 2 of Kelley et al. (2021).

References

Kelley, D. E., Harbin, J., & Richards, C. (2021). argoFloats: An R package for analyzing Argo data. Frontiers in Marine Science, (8), 636922. doi:10.3389/fmars.2021.635922

Author

Dan Kelley

Examples

# Read from a local file
f <- system.file("extdata", "SR2902204_131.nc", package="argoFloats")
p <- readProfiles(f)
#> Warning: Of 1 profiles read, 1 has >10% of BBP700 values with QC flag of 4, signalling bad data.
#>     The indices of the bad profiles are as follows.
#>     1
#> Warning: Of 1 profiles read, 1 has >10% of chlorophyllA values with QC flag of 4, signalling bad data.
#>     The indices of the bad profiles are as follows.
#>     1
#> Warning: Of 1 profiles read, 1 has >10% of oxygen values with QC flag of 4, signalling bad data.
#>     The indices of the bad profiles are as follows.
#>     1
#> Warning: Of 1 profiles read, 1 has >10% of pressure values with QC flag of 4, signalling bad data.
#>     The indices of the bad profiles are as follows.
#>     1