xrscipy.signal.decimate

xrscipy.signal.decimate(darray: DataArray, q: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] = None, target_fs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] = None, dim: str = None, **lowpass_kwargs) DataArray

Decimate signal by given (int) factor or to closest possible target_fs along the specified dimension.

Decimation: lowpass to new nyquist frequency and then downsample by factor q lowpass_kwargs are given to the lowpass method.

If q is not given, it is approximated as the closest integer ratio of fs / target_fs, so target_fs must be smaller than current sampling frequency fs.

If q < 2, decimation is skipped and a DecimationWarning is emitted

Parameters:
  • darray (DataArray) – An xarray type data to be decimated.

  • q (array_like) – A scalar specifying the factor by which the signal should be decimated. If not given, it is approximated as the closest integer ratio of fs / target_fs. If set lower than 2, decimation is skipped and a DecimationWarning is emitted. Default is None.

  • target_fs (array_like, optional) – A scalar specifying target sampling frequency of returning data. Must be smaller than current sampling frequency. Default is None.

  • dim (string, optional) – A string specifing the dimension along which the filter is applied. If darray is 1-d then the dimension is found if not specified by dim. For multi dimensional darray has to be specified, otherwise ValueError is raised. Default is None.

  • lowpass_kwargs – Arbitrary keyword arguments passed to the lowpass method. See lowpass method for further details.