Export MUSIC Table from SeaSondeRCS Object
Source:R/SeaSondeRCS_MUSIC.R
      seasonder_exportMUSICTable.RdThis function generates a table containing detailed MUSIC detection data from a SeaSondeRCS object. The output table includes geographic coordinates, signal parameters, and other metadata for each MUSIC detection.
Value
A data frame with the following columns:
- datetime: Timestamp of the data.
- longitude: Geographic longitude of the detection.
- latitude: Geographic latitude of the detection.
- range_cell: Range cell number.
- range: Range in kilometers.
- doppler_bin: Doppler bin number.
- doppler_freq: Doppler frequency.
- radial_velocity: Radial velocity in m/s.
- signal_power: Signal power.
- bearing: Geographic bearing in degrees.
- bearing_raw: Original MUSIC bearing in degrees.
- noise_level: Noise level in dB.
- signal_power_db: Signal power in dB.
- SNR: Signal-to-noise ratio in dB.
- DOA_peak_resp_db: DOA peak response in dB.
Details
This function performs the following operations:
- Retrieves the timestamp ( - nDateTime) from the header of the- SeaSondeRCSobject. Defaults to- as.POSIXct(0)if unavailable.
- Initializes an empty data frame with predefined columns. 
- Retrieves MUSIC detection data, processes the Direction of Arrival (DOA) and geographic coordinates ( - lonlat), and unnests these fields.
- Converts MUSIC bearings to geographic bearings using the associated Antenna Pattern Matrix (APM) object. 
- Computes additional metrics such as signal power in dB, signal-to-noise ratio (SNR), and DOA peak response in dB. 
- Appends the timestamp to the table and reorders columns for clarity. 
Examples
# \donttest{
  # Load sample CSS and APM files
  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.
  # Create SeaSondeRCS object with APM
  cs_obj <- seasonder_createSeaSondeRCS(cs_file, seasonder_apm_object = apm_obj)
#> new_SeaSondeRCS:  SeaSondeRCS object created successfully.
FOR <- seasonder_getSeaSondeRCS_FOR(cs_obj)
cs_obj <- seasonder_setSeaSondeRCS_FOR(cs_obj,FOR[4:5])
  # Run MUSIC algorithm (in FOR context) if MUSIC data is available:
  cs_obj <- seasonder_runMUSICInFOR(cs_obj)
#> seasonder_runMUSIC:  MUSIC algorithm started.
#> seasonder_runMUSIC:  MUSIC algorithm finished.
  # Export MUSIC table
  music_table <- seasonder_exportMUSICTable(cs_obj)
  print(music_table)
#> # A tibble: 7 × 15
#>   datetime            longitude latitude range_cell range doppler_bin
#>   <dttm>                  <dbl>    <dbl>      <int> <dbl>       <int>
#> 1 2024-04-04 07:00:00     -8.80     42.2          1 0.187         333
#> 2 2024-04-04 07:00:00     -8.80     42.2          1 0.187         334
#> 3 2024-04-04 07:00:00     -8.80     42.2          1 0.187         334
#> 4 2024-04-04 07:00:00     -8.80     42.2          1 0.187         342
#> 5 2024-04-04 07:00:00     -8.80     42.2          1 0.187         342
#> 6 2024-04-04 07:00:00     -8.80     42.2          1 0.187         343
#> 7 2024-04-04 07:00:00     -8.80     42.2          2 0.374         343
#> # ℹ 9 more variables: doppler_freq <dbl>, radial_velocity <dbl>,
#> #   signal_power <dbl>, bearing <dbl>, bearing_raw <dbl>, noise_level <dbl>,
#> #   signal_power_db <dbl>, SNR <dbl>, DOA_peak_resp_db <dbl>
# }