ncdf4_convert_from_path | R Documentation |
Scan and convert NetCDF format 3 files into a custom TargetSearch NetCDF format 4
automatically. The function scans the given input path(s) for files with "cdf"
extension.
This function simply wraps around ncdf4_convert()
, so that function
will then convert each detected file.
ncdf4_convert_from_path(cdf_path = ".", out_path = cdf_path, recursive = FALSE, ignore.case = TRUE, ...)
cdf_path |
Character string. The path(s) to scan for CDF files. |
out_path |
Character string. The output path(s) in which the converted files will be saved. |
recursive |
Logical. Should the search recurse into directories? |
ignore.case |
Logical. Should the file extension matching be case insensitive? |
... |
Extra options passed to |
This function simply searches for CDF-3 files and converts them to CDF-4 (custom format). By default the current path is scanned and files are converted and save in the same place.
Multiple input directories can be given. If this is the case, the output path out_path
must
be either a single path (in which case all files will be copied to the same directory) or an equal
number of paths, such that there is a corresponding match between input and output directories.
If not, an assertion error will be raised.
By default the search is case insensitive (see parameter ignore.case
). For sensitive
case matching, the function looks for all lowercase extension cdf
. At the moment,
it is not possible to change this pattern.
If recursive
is TRUE
, the search will also descend into subdirectories and
the converted files will follow a similar directory structure. Output directories will be
created on demand if required (this is actually done by ncdf4_convert()
internally).
A character vector of generated files or invisible.
Alvaro Cuadros-Inostroza
ncdf4_convert()
, baseline()
# in this example we'll use a temporary directory as source
# and storage of CDF (because we need to reduce testing time in Bioc)
# get some files from package TargetSearchData and copy them
# to `srcdir`
require(TargetSearchData)
cdffiles <- tsd_cdffiles()[1:4]
srcdir <- file.path(tempdir(), 'gc-ms-data')
dir.create(srcdir)
file.copy(cdffiles, srcdir)
# convert to output directory set above
outdir <- tempfile()
ncdf4_convert_from_path(srcdir, outdir)
# recursive search. note that output files will be saved under "gc-ms-data"
# in the output directory
cdfpath <- tempdir() # (base path where we copy the CDF files)
ncdf4_convert_from_path(cdfpath, outdir, recursive=TRUE)
# clean-up the mess
unlink(c(srcdir, outdir), recursive=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.