seasonder_validateCSDataStructure {SeaSondeR} | R Documentation |
Validate the Data Structure of CrossSpectra Data
Description
This function checks the validity of the data
structure for CrossSpectra (CS) data. It ensures that all required fields are present,
the dimensions of the matrices are correct based on nRanges
and nDoppler
, and that the types of the data fields are as expected.
Usage
seasonder_validateCSDataStructure(data, nRanges, nDoppler)
Arguments
data |
A list representing the CrossSpectra (CS) data. It should contain fields "SSA1", "SSA2", "SSA3", "CS12", "CS13", "CS23", and "QC". |
nRanges |
An integer specifying the expected number of range cells. |
nDoppler |
An integer specifying the expected number of Doppler cells. |
Details
The function expects the following structure for the data
list:
-
SSA1
,SSA2
,SSA3
,QC
: Matrices with numeric values, with dimensionsnRanges
xnDoppler
. -
CS12
,CS13
,CS23
: Matrices with complex values, with dimensionsnRanges
xnDoppler
.
Value
Invisible NULL if the data structure is valid. Otherwise, an error is thrown.
Error Management
This function utilizes the rlang
package to manage errors and provide detailed and structured error messages:
Condition Classes:
-
seasonder_CS_data_structure_validation_error
: An error class indicating a problem with the data structure of the CrossSpectra (CS) data.
Condition Cases:
Missing fields in the data.
Incorrect dimensions for the matrices in the data.
Incorrect data type for the fields in the data.
Examples
# Example with all required fields
data <- list(
SSA1 = matrix(rep(NA_real_, 10 * 20), ncol = 20, byrow = TRUE),
SSA2 = matrix(rep(NA_real_, 10 * 20), ncol = 20, byrow = TRUE),
SSA3 = matrix(rep(NA_real_, 10 * 20), ncol = 20, byrow = TRUE),
CS12 = matrix(complex(real = NA, imaginary = NA), nrow = 10, ncol = 20),
CS13 = matrix(complex(real = NA, imaginary = NA), nrow = 10, ncol = 20),
CS23 = matrix(complex(real = NA, imaginary = NA), nrow = 10, ncol = 20),
QC = matrix(rep(NA_real_, 10 * 20), ncol = 20, byrow = TRUE)
)
seasonder_validateCSDataStructure(data, 10, 20)