Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gsw/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ def wrapper(*args, **kwargs):
)
where = ~mask

new_kwargs = {"where": where}
# Values under the mask are left uninitialized, which is fine for masked
# arrays; passing out=None explicitly avoids numpy's "'where' used
# without 'out'" warning. Multi-output ufuncs need one None per output.
nout = len(f.types[0].split("->")[1]) if hasattr(f, "types") else 1
out = None if nout == 1 else (None,) * nout

new_kwargs = {"where": where, "out": out}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that #308 is merged this could become:

new_kwargs = {"where": where, "out": (None, ) * f.nout}

new_kwargs.update(
**kwargs
) # Allow user override of the where kwarg if they passed it in.
Expand Down
Loading