Skip to contents

This function identifies the type of a spectra file (either "CS" or "CSSY") by reading its header block based on YAML specifications. It first attempts to read a key size block using the CSSY specifications, and if that fails, it reopens the file and tries to read the CS header block.

Usage

seasonder_find_spectra_file_type(filepath, endian = "big")

Arguments

filepath

A character string specifying the path to the spectra file.

endian

A character string indicating the file's byte order ("big" by default).

Value

A character string representing the spectra file type ("CS" or "CSSY").

Details

The function sets up error handling parameters and uses YAML specifications retrieved via seasonder_readYAMLSpecs and seasonder_defaultSpecsFilePath. It opens the file in binary read mode and ensures the connection is closed upon exit. If reading the key size block fails, it reopens the file to try reading the CS header block. The final file type is determined by the key returned from the file block.