Convert Doppler Frequencies to Doppler Bins
Source:R/SeaSondeRCS.R
seasonder_computeDopplerFreq2Bins.RdThis function converts a set of Doppler frequency values into their corresponding Doppler bin indices using predefined Doppler frequency bins and frequency step size.
Usage
seasonder_computeDopplerFreq2Bins(
seasonder_cs_object,
doppler_values,
doppler_freqs,
delta_freq,
nDoppler
)Arguments
- seasonder_cs_object
A
SeaSondeRcross-spectral object.- doppler_values
A numeric vector specifying the Doppler frequencies to be converted into bin indices.
- doppler_freqs
A numeric vector containing the Doppler frequencies corresponding to each bin.
- delta_freq
A numeric scalar specifying the frequency step size (difference between consecutive Doppler bins).
- nDoppler
An integer indicating the total number of Doppler bins.
Value
An integer vector of Doppler bin indices corresponding to the input Doppler frequencies. Values that fall outside the valid bin range are assigned NA.
Details
The function constructs a set of bin boundaries using the Doppler frequencies. The leftmost boundary is adjusted by subtracting delta_freq from the first Doppler frequency to extend the range.
The function then applies findInterval to determine the corresponding bin index for each input Doppler frequency. The bin assignment process follows these rules:
rightmost.closed = TRUE: The last bin interval includes its upper boundary.all.inside = FALSE: Values outside the defined frequency range are assigned indices below 1 or abovenDoppler.left.open = TRUE: The left interval is open, meaning values exactly equal to a boundary are assigned to the higher bin.
After determining the bin indices, values that are out of range (bins < 1 or bins > nDoppler) are set to NA.
See also
seasonder_Bins2NormalizedDopplerFreq for converting bins back to normalized Doppler frequencies.
findInterval for details on interval-based bin selection.