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

Accept missing_dims in Variable.transpose and Dataset.transpose #5586

Merged

Conversation

gcaria
Copy link
Contributor

@gcaria gcaria commented Jul 7, 2021

Regarding #5550 (comment), inside the for loop only a Variable's dimensions are selected for the transpose, so a dimension that it's missing in all DataArrays would just be ignored silently. Hence it's necessary to check at the beginning of the function.

var_dims = tuple(dim for dim in dims if dim in (var.dims + (...,)))

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2021

Unit Test Results

         6 files           6 suites   59m 48s ⏱️
16 172 tests 14 455 ✔️ 1 717 💤 0 ❌
90 228 runs  82 091 ✔️ 8 137 💤 0 ❌

Results for commit da3cec5.

♻️ This comment has been updated with latest results.

@headtr1ck
Copy link
Collaborator

It could be great to include the transpose_coords argument for Dataset.transpose in this PR to have the interface the same as for DataArray.transpose.

@max-sixty
Copy link
Collaborator

This looks great! Any thoughts before we merge? @gcaria do you want to add a whatsnew?

Agree re transpose_coords but no need to couple it with this PR

@max-sixty max-sixty added the plan to merge Final call for comments label Jul 7, 2021
@TomNicholas TomNicholas mentioned this pull request Jul 8, 2021
8 tasks
@dcherian
Copy link
Contributor

Thanks @gcaria

rtd failure is unrelated and looks like a flaky connection.

@dcherian dcherian changed the title Accept missing_dims argument for Variable.transpose and Dataset.transpose Accept missing_dims in Variable.transpose and Dataset.transpose Jul 17, 2021
@dcherian dcherian merged commit 293613e into pydata:main Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dataset.transpose support for missing_dims
4 participants