Skip to contents

This function performs multiple validation checks on a provided CS file in the SeaSondeR system. It checks the file for various conditions to determine if it meets the SeaSondeR standards.

Usage

seasonder_validateCSFileData(filepath, header)

Arguments

filepath

A character string indicating the path to the CS file to validate.

header

A list containing header information of the CS file.

Value

NULL invisibly. The function mainly serves to validate and will stop execution and log an error using seasonder_logAndAbort if any condition fails.

Details

The function performs the following validation checks:

  1. Verifies that the file size is greater than 10 bytes.

  2. Validates the nCsFileVersion field in the header to ensure it's between 1 and 32.

  3. Depending on the nCsFileVersion, verifies the appropriate file size, and the extent of various version headers (nV1Extent, nV2Extent, etc.).

  4. Validates the nRangeCells and nDopplerCells fields to ensure they are within permissible ranges.

  5. Depending on the nCsKind value, validates the file size against expected sizes based on nRangeCells, nSpectraChannels, and nDopplerCells.

Condition Management

This function utilizes the rlang package to manage conditions and provide detailed and structured condition messages:

Condition Classes:

  • seasonder_validate_cs_file_error: An error class that indicates a validation requirement was not met.

Condition Cases:

  • Failure on any validation test.

References

Cross Spectra File Format Version 6. CODAR. 2016