seasonder_createSeaSondeRCS.character {SeaSondeR} | R Documentation |
Create a SeaSondeRCS object from a file path
Description
This method creates a SeaSondeRCS object by reading a file from the specified file path.
It verifies the file's existence, determines the file type ("CS", "CSSY" or "CSSW") using
seasonder_find_spectra_file_type
, and then reads the file using the appropriate function.
If specs_path
is not provided (or is set to rlang::zap()
), the default YAML specifications
file path is retrieved using seasonder_defaultSpecsFilePath
based on the detected file type.
Usage
## S3 method for class 'character'
seasonder_createSeaSondeRCS(x, specs_path = rlang::zap(), endian = "big", ...)
Arguments
x |
A character string specifying the path to the SeaSonde CS file. |
specs_path |
A character string specifying the path to the YAML specifications for the CS file.
If not provided or set to |
endian |
A character string indicating the byte order. Options are "big" (default) or "little". |
... |
Additional parameters passed to |
Details
The function performs the following steps:
Checks if the file specified by
x
exists; if not, it aborts with an error.Determines the file type using
seasonder_find_spectra_file_type
.If
specs_path
is not provided or is set torlang::zap()
, retrieves the default YAML specifications path usingseasonder_defaultSpecsFilePath
based on the detected file type.Reads the file using the appropriate function:
-
seasonder_readSeaSondeCSFile
for CS files. -
seasonder_readSeaSondeRCSSYFile
for CSSY files. -
seasonder_readSeaSondeRCSSWFile
for CSSW files.
-
Creates a SeaSondeRCS object using
new_SeaSondeRCS
with the header and data obtained from the file.Appends a processing step indicating the creation source via
seasonder_setSeaSondeRCS_ProcessingSteps
with a creation step text generated bySeaSondeRCS_creation_step_text(x)
.
Value
A SeaSondeRCS object.
See Also
new_SeaSondeRCS
,
seasonder_find_spectra_file_type
,
seasonder_defaultSpecsFilePath
,
seasonder_readSeaSondeCSFile
,
seasonder_readSeaSondeRCSSYFile
,
seasonder_readSeaSondeRCSSWFile
,
seasonder_setSeaSondeRCS_ProcessingSteps
,
SeaSondeRCS_creation_step_text
Examples
# Create a SeaSondeRCS object from a file using the default YAML specifications
rcs_object <- seasonder_createSeaSondeRCS(
system.file("css_data/CSS_TORA_24_04_04_0700.cs", package = "SeaSondeR")
)
# Create a SeaSondeRCS object from a file with a specified YAML specifications file
rcs_object <- seasonder_createSeaSondeRCS(
system.file("css_data/CSS_TORA_24_04_04_0700.cs", package = "SeaSondeR"),
specs_path = seasonder_defaultSpecsFilePath("CS")
)