Fix UxDataset.to_array() missing args/kwargs dim and name#1521
Fix UxDataset.to_array() missing args/kwargs dim and name#1521Sevans711 wants to merge 2 commits into
Conversation
UxDataset.to_array() did not allow args/kwargs, even though Dataset.to_array() allows to input `dim` and `name`. This commit allows UxDataset.to_array() to accept dim and name (they are simply passed through to super().to_array()), and also adds a corresponding test in test_dataset.py.
Forgot to pre-commit run --all-files before committing 8e1a83f
|
Thanks @Sevans711 for the contribution! Clean fix and good test coverage. We'd love to know what use case prompted this — always helpful to understand how people are using UXarray in practice. Please keep the issues and PRs coming! |
rajeeja
left a comment
There was a problem hiding this comment.
LGTM — clean fix, good test coverage.
|
Sweet! I don't yet have a full science use case for this, I was just taking a closer look at UXarray and how it works! In addition to using UXarray's builtin plotting routines I also tried applying some of my plotting routines from my previous xarray experience to try to understand the raw data (from my package PlasmaCalcs which relies heavily on xarray). Many of those routines try to be extremely flexible about inputs, such as automatically converting Dataset to DataArray but with a custom method that first checks the resulting array won't be "unexpectedly way too big" due to combining data_vars with unrelated dimensions. That method takes an optional "dim" kwarg (set to dim='variable' by default) for the conversion, which caused me to notice the crash when supplying a UxDataset instead. |
Closes #1520
Overview
UxDataset.to_array() did not allow args/kwargs, even though Dataset.to_array() allows to input
dimandname. This commit allows UxDataset.to_array() to accept dim and name (they are simply passed through to super().to_array()), and also adds a corresponding test in test_dataset.py.Expected Usage
PR Checklist
General
Testing
Documentation
_) and have been added todocs/internal_api/index.rstdocs/user_api/index.rst