readProfiles: Read Argo Profiles From Local Files

Description Usage Arguments Details Value Author(s) References Examples

View source: R/read.R

Description

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.

Usage

1
2
3
4
5
6
7
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 TRUE to show more verbose information when downloading files. (Problems will still be reported, though.)

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.

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).

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().

Author(s)

Dan Kelley

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

Examples

1
2
3
# Read from a local file
f <- system.file("extdata", "SR2902204_131.nc", package="argoFloats")
p <- readProfiles(f)

dankelley/argoFloats documentation built on Oct. 19, 2021, 1:17 p.m.