@@ -13,17 +13,15 @@ def _diffz_first(dat, z):
1313
1414
1515def _diffz_centered (dat , z ):
16- """
17- Newton's Method centered difference.
16+ """Newton's Method centered difference.
1817 Want top - bottom here: (u_x+1 - u_x-1)/dx
1918 Can use 2*np.diff b/c depth bin size never changes
2019 """
2120 return (dat [2 :]- dat [:- 2 ]) / (2 * np .diff (z )[1 :, None ])
2221
2322
2423def _diffz_centered_extended (dat , z ):
25- """
26- Extended centered difference method.
24+ """Extended centered difference method.
2725 Top - bottom centered difference with endpoints determined
2826 with a first difference. Ensures the output array is the
2927 same size as the input array.
@@ -319,7 +317,6 @@ def _stress_func_warnings(self, ds, beam_angle, noise, tilt_thresh):
319317 -------
320318 b_angle : float
321319 If 'beam_angle' was None, it tries to find it in 'ds'.
322-
323320 noise : float
324321 If 'noise' was None, it is set to 0.
325322 """
@@ -373,20 +370,19 @@ def _check_orientation(self, ds, orientation, beam5=False):
373370 Parameters
374371 ----------
375372 ds : xarray.Dataset
376- An xarray Dataset containing the ADCP data.
373+ Raw dataset in beam coordinates
377374 orientation : str
378375 The orientation of the instrument, either 'up' or 'down'.
379376 If None, the orientation will be retrieved from the dataset or the
380377 instance's default orientation.
381-
382378 beam5 : bool, default=False
383379 A flag indicating whether a fifth beam is present.
384380 If True, the number 4 will be appended to the beam order.
385381
386382 Returns
387383 -------
388384 beams : list of int
389- A list of integers representing the order of the beams .
385+ Beam order.
390386 phi2 : float, optional
391387 The mean of the roll values in radians. Only returned if 'beam5' is True.
392388 phi3 : float, optional
@@ -428,8 +424,30 @@ def _check_orientation(self, ds, orientation, beam5=False):
428424 return beams
429425
430426 def _beam_variance (self , ds , time , noise , beam_order , n_beams ):
431- """Calculate along-beam velocity variance and subtract noise
432427 """
428+ Calculates the variance of the along-beam velocities and then subtracts
429+ noise from the result.
430+
431+ Parameters
432+ ----------
433+ ds : xarray.Dataset
434+ Raw dataset in beam coordinates
435+ time : xarray.DataArray
436+ Ensemble-averaged time coordinate
437+ noise : int or xarray.DataArray (time)
438+ Doppler noise level in units of m/s
439+ beam_order : list of int
440+ Beam order in pairs, per manufacturer and orientation
441+ n_beams : int
442+ Number of beams
443+
444+ Returns
445+ -------
446+ bp2_ : xarray.DataArray
447+ Enxemble-averaged along-beam velocity variance,
448+ written "beam-velocity prime squared bar" in units of m^2/s^2
449+ """
450+
433451 # Concatenate 5th beam velocity if need be
434452 if n_beams == 4 :
435453 beam_vel = ds ['vel' ].values
@@ -481,6 +499,7 @@ def reynolds_stress_4beam(self, ds, noise=None, orientation=None, beam_angle=Non
481499 of Reynolds stress profiles in unstratified tidal flow." Journal of
482500 Geophysical Research: Oceans 104.C5 (1999): 10933-10949.
483501 """
502+
484503 # Run through warnings
485504 b_angle , noise = self ._stress_func_warnings (
486505 ds , beam_angle , noise , tilt_thresh = 5 )
@@ -551,6 +570,7 @@ def stress_tensor_5beam(self, ds, noise=None, orientation=None, beam_angle=None,
551570 five-beam acoustic Doppler current profilers." Journal of Atmospheric
552571 and Oceanic Technology 34.6 (2017): 1267-1284.
553572 """
573+
554574 # Check that beam 5 velocity exists
555575 if 'vel_b5' not in ds .data_vars :
556576 raise Exception ("Must have 5th beam data to use this function." )
0 commit comments