Write acoustic data as XML file(s).

WriteAcoustic(
  AcousticData,
  FileNames = character(),
  namespaces = character(),
  encoding = "UTF-8",
  overwrite = FALSE
)

Arguments

AcousticData

AcousticData data to write.

FileNames

paths to files that should be written to

namespaces

XML namespaces to use for formatting.

encoding

encoding to use for writing files

overwrite

whether to overwrite any existing file(s)

Details

AcousticData may contain several data sets. In that case the parameters 'FileNames' and 'namespaces' must be provided for each in the order they appear in 'AcousticData'.

Supports writing to namespaces: http://www.imr.no/formats/nmdechosounder/v1

Examples

exampleFile <- system.file(
    "testresources","libas_ListUserFile20__L40.0-2259.9_small.xml", package="RstoxData")
acousticData <- ReadAcoustic(exampleFile)
newFile <- tempfile(fileext = ".xml")
WriteAcoustic(acousticData, newFile, namespaces = "http://www.imr.no/formats/nmdechosounder/v1")
acousticDataReadBackIn <- ReadAcoustic(newFile)
all.equal(
  acousticData[[1]][names(acousticData[[1]]) != "metadata"], 
  acousticDataReadBackIn[[1]][names(acousticDataReadBackIn[[1]]) != "metadata"]
)
#> [1] "Component “sa”: Column 'ch': Mean relative difference: 0.2962963"        
#> [2] "Component “acocat”: Column 'acocat': Mean relative difference: 0.7692308"