Create an RDI adp file by copying the first n data chunks (starting with byte 0x7f 0x7f) of another such file. This can be useful in supplying small sample files for bug reports.

adpRdiFileTrim(infile, n = 100L, outfile, debug = getOption("oceDebug"))



name of an RDI file.


integer indicating the number of data chunks to keep. The default is to keep 100 chunks, a common choice for sample files.


optional name of the new RDI file to be created. If this is not supplied, a default is used, by adding _trimmed to the base filename, e.g. if infile is "a.000" then outfile will be a_trimmed.000.


an integer value indicating the level of debugging. If this is 0, then read.adp.rdi() proceeds quietly, except for issuing warnings and errors if necessary. If it is 1, then the R code of read.adp.rdi() produces some messages. If it is 2, then also the underlying C/C++ code produces a message each time a possible ensemble is detected. If it is 3, then the C/C++ code also produces information on some details of the ensemble. Levels 2 and 3 are mainly for use by the developers.


adpRdiFileTrim() returns the name of the output file, outfile, as provided or constructed.

Sample of Usage

# Can only be run by the developer, since it uses a private file.
file  <- "~/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000"
if (file.exists(file)) {
    adpRdiFileTrim(file, 9L, "test.000")


Dan Kelley