This function writes a copy of an acoustic file in either the NMDEchosounder og ICESAcoustic format, keeping only the logs specified by the user.

cropAcoustic(
  filePath,
  logsToKeep = NULL,
  newFilePath = NULL,
  ow = FALSE,
  suffix = "_croppedLogs."
)

Arguments

filePath

Character: The path to the acoustic file.

logsToKeep

Numeric: The indiced of the logs to keep. NULL implies to keep all logs.

newFilePath

Optional, character: The path to the new file, defaulted to filePath with the suffix before file extension

ow

Logical: If TRUE overwrite the newFilePath.

suffix

Character: The suffix to append to the filePath before the file extension, in the case that newFilePath is not specified

Value

The path to the cropped file.

Examples

exampleFile <- system.file("testresources","ICES_Acoustic_2.xml", package="RstoxData")
acousticData <- ReadAcoustic(exampleFile)
newFilePath <- tempfile(fileext = ".xml")
cropAcoustic(exampleFile, logsToKeep = 2, newFilePath = newFilePath)
#> Warning: incomplete final line found on '/Users/runner/work/_temp/Library/RstoxData/testresources/ICES_Acoustic_2.xml'
#> [1] "/var/folders/t5/f77_gwnj6p95qxy9py3fckx00000gn/T//RtmpvlVD8H/file5c63bca1a48.xml"
croppedAcousticData <- ReadAcoustic(newFilePath)