Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that a and b are xarray objects #29

Open
bradyrx opened this issue Oct 18, 2019 · 3 comments
Open

Check that a and b are xarray objects #29

bradyrx opened this issue Oct 18, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@bradyrx
Copy link
Collaborator

bradyrx commented Oct 18, 2019

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.

@bradyrx
Copy link
Collaborator Author

bradyrx commented Oct 18, 2019

Nevermind this just seems to be a consequence of my PR.

@raybellwaves
Copy link
Member

_check_identical_xr_types is likely to get added in #277. Should help with this issue

@aaronspring
Copy link
Collaborator

I would check that they are both xr, int and float are also sometimes handy to use, see #285

@aaronspring aaronspring added the enhancement New feature or request label Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants