Skip to content

Exception for unsupported window name contains the name's replacement field rather than its value #213

@stanwest

Description

@stanwest

The following session (with abbreviated paths) shows the issue:

>>> import numpy, xarray, xrft
>>> Nx = 16
>>> da = xarray.DataArray(numpy.random.rand(Nx), coords=[numpy.linspace(0, 1.0, Nx)], dims=["x"])
>>> xrft.fft(da, real_dim="x", window='shrubbery')
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    xrft.fft(da, real_dim="x", window='shrubbery')
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\xrft\xrft\xrft.py", line 433, in fft
    _, da = _apply_window(da, dim, window_type=window)
            ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\xrft\xrft\xrft.py", line 73, in _apply_window
    raise NotImplementedError(
        "Window type {window_type} not supported. Please adhere to scipy.signal.windows for naming convention."
    )
NotImplementedError: Window type {window_type} not supported. Please adhere to scipy.signal.windows for naming convention.

The exception message should contain the window name ("shrubbery" above) instead of the replacement field ({window_type}).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions