8000 2x~5x speed up for isel() in most cases by crusaderky · Pull Request #3533 · pydata/xarray · GitHub
[go: up one dir, main page]

Skip to content

2x~5x speed up for isel() in most cases #3533

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

Merged
merged 9 commits into from
Dec 5, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use _replace
  • Loading branch information
crusaderky committed Nov 14, 2019
commit 79fea4d2047d86681d83b8cd62826b8d836d82e7
4 changes: 2 additions & 2 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ def isel(
# Much faster algorithm for when all indexers are ints, slices, one-dimensional
# lists, or zero or one-dimensional np.ndarray's

data = self._variable.isel(indexers)
variable = self._variable.isel(indexers)

coords = {}
for coord_name, coord_value in self._coords.items():
Expand All @@ -1033,7 +1033,7 @@ def isel(
continue
coords[coord_name] = coord_value

return DataArray(data=data, coords=coords, name=self.name, fastpath=True)
return self._replace(variable=variable, coords=coords)

def sel(
self,
Expand Down
0