Skip to content

Commit

Permalink
Edit docstrings
Browse files Browse the repository at this point in the history
Format keyword arguments more consistently and correct spelling.
  • Loading branch information
stanwest committed Feb 14, 2025
1 parent 02feb7e commit 3a5a0f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions xrft/padding.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _pad_coordinates_callback(vector, iaxis_pad_width, iaxis, kwargs):
the function will check if it's equal to zero. It exists for
compatibility with the ``padding_func`` callback that :func:`numpy.pad`
needs.
kwargs : dict
**kwargs
Any keyword arguments the function requires. The kwargs are ignored in
this function, they exist for compatibility with the ``padding_func``
callback that :func:`numpy.pad` needs.
Expand Down Expand Up @@ -338,13 +338,13 @@ def unpad(da, pad_width=None, **pad_width_kwargs):
{dim: pad} is a shortcut for pad_before = pad_after = pad.
If ``None``, then the *pad_width* for each coordinate is read from
their ``pad_width`` attribute.
**pad_width_kwargs (optional)
**pad_width_kwargs
The keyword arguments form of ``pad_width``.
Pass ``pad_width`` or ``pad_width_kwargs``.
Returns
-------
da_unpaded : :class:`xarray.DataArray`
da_unpadded : :class:`xarray.DataArray`
Unpadded array.
See also
Expand Down
9 changes: 6 additions & 3 deletions xrft/xrft.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ def power_spectrum(
If scaling = 'density', correct for the energy (integral) of the spectrum. This ensures, for example, that the power spectral density integrates to the square of the RMS of the signal (ie that Parseval's theorem is satisfied). Note that in most cases, Parseval's theorem will only be approximately satisfied with this correction as it assumes that the signal being windowed is independent of the window. The correction becomes more accurate as the width of the window gets large in comparison with any noticeable period in the signal.
If False, the spectrum gives a representation of the power in the windowed signal.
Note that when True, Parseval's theorem may only be approximately satisfied.
kwargs : dict : see xrft.fft for argument list
**kwargs
See `xrft.fft` for valid arguments.
"""

if "density" in kwargs:
Expand Down Expand Up @@ -793,7 +794,8 @@ def cross_spectrum(
If True, the phase information is retained.
Set explicitly true_phase = False in cross_spectrum arguments list to ensure future compatibility
with numpy-like behavior where the coordinates are disregarded.
kwargs : dict : see xrft.fft for argument list
**kwargs
See `xrft.fft` for valid arguments.
"""

if "real" in kwargs:
Expand Down Expand Up @@ -859,7 +861,8 @@ def cross_phase(da1, da2, dim=None, true_phase=True, **kwargs):
If True, the phase information is retained.
Set explicitly true_phase = False in cross_spectrum arguments list to ensure future compatibility
with numpy-like behavior where the coordinates are disregarded.
kwargs : dict : see xrft.fft for argument list
**kwargs
See `xrft.fft` for valid arguments.
"""

cp = xr.apply_ufunc(
Expand Down

0 comments on commit 3a5a0f2

Please # to comment.