Skip to contents

This function extracts radial metrics from a SeaSondeRCS object and formats them for export using defined mustache templates. The formatted output, which includes MUSIC parameters, antenna pattern corrections, noise thresholds, and other spectral metrics, is written to a specified file. Additionally, the function returns the computed radial metrics as a data frame.

Usage

seasonder_exportLLUVRadialMetrics(seasonder_cs_object, LLUV_path, ...)

Arguments

seasonder_cs_object

A SeaSondeRCS object containing MUSIC detection data and related metadata.

LLUV_path

A character string specifying the output file path for the LLUV radial metrics.

...

Additional arguments passed to seasonder_exportRadialMetrics.

Value

Invisibly returns a data frame containing the radial metrics used in the export.

Details

The function performs the following steps:

  1. Retrieves the radial metrics from the SeaSondeRCS object using seasonder_exportRadialMetrics.

  2. Obtains MUSIC parameters and antenna pattern attributes from the object.

  3. Formats numeric values using predefined formats for each column.

  4. Renders a data template (from "LLUV_RDM1_data.mustache") with the formatted radial metrics.

  5. Generates a deterministic UUID from the rendered data.

  6. Renders an overall LLUV template (from "LLUV_RDM1.mustache") that incorporates the radial parameters, formatted data, header information, and the generated UUID.

  7. Writes the rendered LLUV content to the file specified by LLUV_path.

Examples

# Prepare a SeaSondeRCS object with MUSIC data
apm_file <- system.file("css_data/MeasPattern.txt", package = "SeaSondeR")
apm_obj <- seasonder_readSeaSondeRAPMFile(apm_file)
#> seasonder_createSeaSondeRAPM:  APM object created successfully.
cs_file <- system.file("css_data/CSS_TORA_24_04_04_0700.cs", package = "SeaSondeR")
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])
# Optionally, run MUSIC in FOR context to populate MUSIC data
cs_obj <- seasonder_runMUSICInFOR(cs_obj)
#> seasonder_runMUSIC:  MUSIC algorithm started.
#> seasonder_runMUSIC:  MUSIC algorithm finished.
radial_metrics <- seasonder_exportLLUVRadialMetrics(cs_obj, tempfile(fileext = ".ruv"))
head(radial_metrics)
#>        LOND     LATD        VELU        VELV VFLG      RNGE BEAR       VELO
#> 1 -8.803399 42.20252 -0.73150986   0.8124240    0 0.1870365  318 -1.0932243
#> 2 -8.803050 42.20271  0.08548836  -0.1422765    0 0.1870365  329  0.1659845
#> 3 -8.801221 42.20288 -0.04852919  -0.1587318    0 0.1870365   17  0.1659845
#> 4 -8.802199 42.20293  1.42508463 -10.1400040    0 0.1870365  352 10.2396556
#> 5 -8.804139 42.20112 10.20069064   0.8924448    0 0.1870365  265 10.2396556
#> 6 -8.801183 42.20287 -3.55334455 -10.9360700    0 0.1870365   18 11.4988645
#>   HEAD SPRC SPDC MSEL MSA1 MDA1 MDA2      MEGR     MPKR        MOFR       MP13
#> 1  138    1  332    1  318   16 1440 37.517644 0.000000 0.000000000   9.817918
#> 2  149    1  333    2  347  329   17 18.529681 1.281161 0.008196858 -10.360013
#> 3  197    1  333    3  347  329   17 18.529681 1.281161 0.008196858 -10.360013
#> 4  172    1  341    2   18  352  265 10.680977 1.255016 0.480175432  18.178391
#> 5   85    1  341    3   18  352  265 10.680977 1.255016 0.480175432  18.178391
#> 6  198    1  342    1   18  357   11  7.646877 1.087325 0.966261326   5.698105
#>        MP23      MSP1      MDP1      MDP2 MSW1 MDW1 MDW2      MSR1        MDR1
#> 1 -74.77181 -94.73992 -94.11004   0.00000   88    2    0  6.030989 10797.14624
#> 2 -52.03949 -93.92921 -96.44397 -97.52001   21    4   91 43.954436  3684.43241
#> 3 -52.03949 -93.92921 -96.44397 -97.52001   21    4   91 43.954436  3684.43241
#> 4 -77.73468 -93.13555 -94.14548 -93.15898   52    3  142  7.804122 10080.28745
#> 5 -77.73468 -93.13555 -94.14548 -93.15898   52    3  142  7.804122 10080.28745
#> 6 -83.72088 -93.22757 -81.36097 -80.99737   58   30   38  7.408590    98.57057
#>        MDR2     MA1S     MA2S     MA3S         MEI1         MEI2         MEI3
#> 1  0.000000 1.360982 9.018854 6.186278 5.473080e-10 1.458802e-11 5.887997e-12
#> 2 33.138962 3.853958 8.727675 7.514739 6.686443e-10 3.608504e-11 6.028202e-12
#> 3 33.138962 3.853958 8.727675 7.514739 6.686443e-10 3.608504e-11 6.028202e-12
#> 4  1.349332 5.822285 6.497650 8.659952 7.490601e-10 7.013029e-11 4.088580e-12
#> 5  1.349332 5.822285 6.497650 8.659952 7.490601e-10 7.013029e-11 4.088580e-12
#> 6 56.402574 5.526817 7.654325 8.519368 7.301015e-10 9.547708e-11 2.856018e-12
#>   MDRJ PPFG PWFG
#> 1   16    9    9
#> 2    0    9    9
#> 3    0    9    9
#> 4    0    9    9
#> 5    0    9    9
#> 6   12    9    9