-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
implemented pad with new-indexes #4974
Closed
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b8cc48b
implemented pad with new-indexes
fujiisoup f65c4c9
pre-commit hook
fujiisoup 4a4c514
Update xarray/core/dataset.py
fujiisoup f40ae1d
Update xarray/core/dataarray.py
fujiisoup ed7cfa2
Apply suggestions from code review
fujiisoup 36e3e39
Apply suggestions from code review
mathause c49ef3a
Apply suggestions from code review
fujiisoup 99daf64
Update xarray/core/dataset.py
fujiisoup 07a01b4
A bug fix; now int can be passed as an argument.
fujiisoup 6662385
Added equivalent tests for doctest, but not failing
fujiisoup c130af4
Fix indent
fujiisoup ac7bf70
doctest
fujiisoup 9b90769
Added Variable.pad_indexes
fujiisoup 69abc13
Merge branch 'master' into index_pad
fujiisoup 1ae6afb
Merge branch 'master' into index_pad
fujiisoup 30391c6
Update xarray/core/dataarray.py
dcherian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1362,6 +1362,15 @@ def pad( | |
|
||
return type(self)(self.dims, array) | ||
|
||
def pad_indexes(self, pad_start: Sequence, pad_end: Sequence): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this |
||
""" | ||
Return a new (Index)Variable with [pad_start, pad_end] padded at the head and tail | ||
of the original array. Used in dataset.pad | ||
""" | ||
start = type(self)(self.dims[0], pad_start) | ||
end = type(self)(self.dims[0], pad_end) | ||
return type(self).concat([start, self, end], dim=self.dims[0]) | ||
|
||
def _roll_one_dim(self, dim, count): | ||
axis = self.get_axis_num(dim) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that a mixture of sequence and int for pad_width, like
makes implementation very complex (as we may need to support many options, such as pad_mode).
I just disallowed the mixed argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍