Skip to contents

This function updates a single MUSIC option in the MUSIC data of a SeaSondeRCS object. It verifies that the provided option name is valid (i.e. exists in the default options), then updates that field with the new value.

Usage

seasonder_setMUSICOption(seasonder_cs_object, option_name, option_value)

Arguments

seasonder_cs_object

A SeaSondeRCS object that contains the MUSIC data as an attribute.

option_name

A character string specifying the name of the MUSIC option to update.

option_value

The new value to assign to the specified MUSIC option.

Value

The updated SeaSondeRCS object with the specified MUSIC option modified.

Details

The function first checks if option_name is one of the valid options as provided by seasonder_defaultMUSICOptions(). If not, it calls seasonder_logAndAbort to log an error. Then, the current MUSIC options are retrieved, updated with the new value, and stored back into the object.

Examples

# Example: set a specific MUSIC option on a minimal CS object
header <- list(nRangeCells = 1, nDopplerCells = 1)
data <- list(
  SSA1 = matrix(0,1,1), SSA2 = matrix(0,1,1), SSA3 = matrix(0,1,1),
  CS12 = matrix(complex(real=0,imaginary=0),1,1),
  CS13 = matrix(complex(real=0,imaginary=0),1,1),
  CS23 = matrix(complex(real=0,imaginary=0),1,1), QC = matrix(0,1,1)
)
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(list(header = header, data = data), 
seasonder_apm_object = apm_obj)
#> Warning: no non-missing arguments to max; returning -Inf
#> new_SeaSondeRCS:  SeaSondeRCS object created successfully.
cs_obj <- seasonder_setMUSICOption(cs_obj, "smoothNoiseLevel", TRUE)
opts <- seasonder_getMUSICOptions(cs_obj)
print(opts$smoothNoiseLevel)
#> [1] TRUE