seasonder_readSeaSondeCSFileData {SeaSondeR} | R Documentation |
Read SeaSonde Cross Spectra (CS) File Data
Description
This function reads the SeaSonde CS file data based on the provided header information.
The CS file data includes the antenna voltage squared self spectra (SSA*
) and the
antenna cross spectra (CSxy
). Additionally, a quality matrix (QC
) is read when the header's
nCsKind
is greater than or equal to 2.
Usage
seasonder_readSeaSondeCSFileData(connection, header, endian = "big")
Arguments
connection |
A connection object to the CS file. |
header |
A list containing the header information. This is typically the output
of the |
endian |
Character string indicating the byte order. Options are "big" (default) or "little". |
Details
-
SSA*
: Represents the Antenna * voltage squared self spectra. These are matrices where each row corresponds to a range and each column to a Doppler cell. -
CSxy
: Represents the cross spectra between two antennas x and y. These are complex matrices. -
QC
: Quality matrix with values ranging from zero to one. A value less than one indicates that the SpectraAverager skipped some data during averaging.
Value
A list containing the processed CS file data including matrices for SSA*, CSxy, and QC (if applicable).
Condition Management
This function utilizes the rlang
package to manage errors and conditions, providing detailed and structured messages:
Error Classes:
-
"seasonder_cs_data_reading_error"
: This error is thrown when there is a problem reading the CS file data. This could be due to issues with the connection object or the file itself. -
"seasonder_cs_missing_header_info_error"
: Thrown if essential header information such asnRangeCells
,nDopplerCells
, ornCsKind
is missing or invalid.
Error Cases:
Connection object is not properly opened or is invalid.
Header information is incomplete or improperly formatted.
File read operations fail due to incorrect data size, type, or unexpected end of file.
Non-numeric values encountered where numeric spectra data is expected.
Examples
con <- rawConnection(as.raw(rep(0, 300)))
header <- list(nRangeCells = 1, nDopplerCells = 5, nCsKind = 2)
data <- seasonder_readSeaSondeCSFileData(con, header, endian = "big")
print(data)
close(con)