Skip to contents

This function applies scaling to each vector of integer values contained in the list values by converting them to floating point voltage values using a specified scaling procedure. For each integer value:

  • If the value equals 0xFFFFFFFF, it returns NaN;

  • Otherwise, it computes an intermediate value using the formula: intermediate = value * (fmax - fmin) / fscale + fmin and then converts it to a voltage via: voltage = 10^((intermediate + dbRef) / 10)

Usage

seasonder_SeaSondeRCSSYApplyScaling(values, fmax, fmin, fscale, dbRef)

Arguments

values

A list of numeric vectors containing integer values to be scaled. Each vector is expected to contain values read from a binary CSSY values block.

fmax

A numeric value representing the maximum scaling value. Used to compute the linear scaling factor.

fmin

A numeric value representing the minimum scaling value. Acts as an offset for the scaling.

fscale

A numeric value representing the scaling factor. Must not be zero as it determines the divisor in the scaling formula.

dbRef

A numeric value representing the decibel reference to be added before the voltage conversion step.

Value

A list with the same structure as values, where each numeric vector has been transformed to a vector of floating point voltage values. Special integer values equal to 0xFFFFFFFF are converted to NaN.

Details

The function processes each vector in the input list and returns a new list having the same structure, but with each value converted into its corresponding voltage value. It also performs several validations regarding input types and values.

The scaling process performs the following steps for each input value:

  1. Checks whether the value equals 0xFFFFFFFF. If so, it returns NaN immediately because this value indicates a missing or invalid measurement.

  2. Otherwise, it computes the intermediate scaled value by applying a linear transformation: intermediate = value * (fmax - fmin) / fscale + fmin

  3. Finally, it converts the intermediate value to a voltage using: voltage = 10^((intermediate + dbRef) / 10)

The function includes input validation to ensure that values is a list, and that fmax, fmin, fscale, and dbRef are numeric. It also checks that no element in values is non-numeric and that fscale is non-zero to prevent division errors.