xskillscore
xskillscore copied to clipboard
Check that `a` and `b` are xarray objects
The docstrings for all deterministic functions claim that ndarrays (i.e. numpy arrays) can be passed through, but that isn't the case since a lot of the preprocessing and wrapper functions leverage xarray methods to set up the package. Given the prefix x for xskillscore, I think it would be reasonable to enforce that a and b have to be xarray objects.
We do this in climpred with a decorator:
https://github.com/bradyrx/climpred/blob/61e397bc07004e292af5b0798d4eca17be5dd263/climpred/checks.py#L19-L57
Which is then applied as a header to relevant functions:
https://github.com/bradyrx/climpred/blob/61e397bc07004e292af5b0798d4eca17be5dd263/climpred/prediction.py#L32-L41
This would be easy to port over to xskillscore and decorate all of the high-level functions with.
Nevermind this just seems to be a consequence of my PR.
_check_identical_xr_types is likely to get added in #277. Should help with this issue
I would check that they are both xr, int and float are also sometimes handy to use, see #285