Skip to contents

This function retrieves a specific value from the SeaSondeRCS object's header based on the provided path. The path can be a single field name or a list of nested field names.

Usage

seasonder_getCSHeaderByPath(seasonder_obj, path, warn_missing = TRUE)

Arguments

seasonder_obj

A SeaSondeRCS object.

path

A character vector specifying the field or nested fields to retrieve.

warn_missing

Logical; if TRUE, a warning is issued if the specified path is not found in the header.

Value

The value at the specified path in the header. If the path is not found, NULL is returned and a warning is thrown.

Condition Management

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

Condition Classes:

  • seasonder_SeaSonderCS_field_not_found_in_header: Indicates that the specified path was not found in the header.

Condition Cases:

  • Field or nested fields specified by the path are not found in the header.

Examples

# Minimal example for seasonder_getCSHeaderByPath
cs_file <- system.file("css_data/CSS_TORA_24_04_04_0700.cs", package = "SeaSondeR")
apm_file <- system.file("css_data/MeasPattern.txt", package = "SeaSondeR")
apm_obj <- seasonder_readSeaSondeRAPMFile(apm_file)
#> seasonder_createSeaSondeRAPM:  APM object created successfully.
cs_obj <- seasonder_createSeaSondeRCS(cs_file, seasonder_apm_object = apm_obj)
#> new_SeaSondeRCS:  SeaSondeRCS object created successfully.
field_value <- seasonder_getCSHeaderByPath(cs_obj, c("nRangeCells"))
print(field_value)
#> [1] 63