-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Pint support for variables #3706
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
Changes from 17 commits
e5a6632
9414fe3
12d2fe4
077d67a
e03fac8
6b65a76
88320ef
1e07dce
3942193
ce572de
8bfc347
3d16f2e
a8cf968
9fdbd56
98e2b40
05946b1
8c490ee
f6eca88
72241e5
2ebfa6b
0a0c2d3
4cadc52
b51caa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -742,7 +742,11 @@ def _getitem_with_mask(self, key, fill_value=dtypes.NA): | |
|
||
data = as_indexable(self._data)[actual_indexer] | ||
mask = indexing.create_mask(indexer, self.shape, data) | ||
data = duck_array_ops.where(mask, fill_value, data) | ||
if isinstance(mask, bool): | ||
mask = not mask | ||
else: | ||
mask = ~mask | ||
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. Could you flip the argument order rather than adding this? I’m a little puzzles here. 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. If the concern here is about consistency when applying But it does feel a little weird to me to see this here. Maybe changing 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. same as the I tried to use |
||
data = duck_array_ops.where(mask, data, fill_value) | ||
else: | ||
# array cannot be indexed along dimensions of size 0, so just | ||
# build the mask directly instead. | ||
|
@@ -1099,24 +1103,21 @@ def _shift_one_dim(self, dim, count, fill_value=dtypes.NA): | |
else: | ||
dtype = self.dtype | ||
|
||
shape = list(self.shape) | ||
shape[axis] = min(abs(count), shape[axis]) | ||
width = min(abs(count), self.shape[axis]) | ||
dim_pad = (width, 0) if count >= 0 else (0, width) | ||
pads = [(0, 0) if d != dim else dim_pad for d in self.dims] | ||
|
||
if isinstance(trimmed_data, dask_array_type): | ||
chunks = list(trimmed_data.chunks) | ||
chunks[axis] = (shape[axis],) | ||
full = functools.partial(da.full, chunks=chunks) | ||
pad_func = da.pad | ||
else: | ||
full = np.full | ||
|
||
filler = full(shape, fill_value, dtype=dtype) | ||
pad_func = np.pad | ||
keewis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if count > 0: | ||
arrays = [filler, trimmed_data] | ||
else: | ||
arrays = [trimmed_data, filler] | ||
|
||
data = duck_array_ops.concatenate(arrays, axis) | ||
data = pad_func( | ||
trimmed_data.astype(dtype), | ||
pads, | ||
mode="constant", | ||
constant_values=fill_value, | ||
) | ||
|
||
if isinstance(data, dask_array_type): | ||
# chunked data should come out with the same chunks; this makes | ||
|
Uh oh!
There was an error while loading. Please reload this page.