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

initial refactor for NamedArray #8075

Merged
merged 83 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
81098cf
initial prototype for NamedArray
andersy005 Aug 16, 2023
27910dc
move NDArrayMixin and NdimSizeLenMixin inside named_array
andersy005 Aug 16, 2023
1a02dac
vendor is_duck_dask_array
andersy005 Aug 16, 2023
636b156
vendor Frozen object
andersy005 Aug 16, 2023
9ba6c84
update import
andersy005 Aug 17, 2023
b1a1de0
move _default sentinel value
andersy005 Aug 17, 2023
1e11e87
rename subpackage to namedarray per @TomNicholas suggestion
andersy005 Aug 17, 2023
ad364f0
Remove NdimSizeLenMixin
andersy005 Aug 17, 2023
d1e8d2a
fix typing
andersy005 Aug 17, 2023
5654063
Merge branch 'main' into named-array
andersy005 Aug 17, 2023
098eb0c
add annotations
andersy005 Aug 17, 2023
38c105a
Remove NDArrayMixin
andersy005 Aug 17, 2023
1fdd281
Apply suggestions from code review
andersy005 Aug 18, 2023
7060268
Merge branch 'main' into named-array
andersy005 Aug 18, 2023
33c2216
fix typing
andersy005 Aug 21, 2023
2c9223d
fix return type
andersy005 Aug 21, 2023
0e4afe0
revert NDArrayMixin
andersy005 Aug 22, 2023
ab79fb1
[WIP] as_compatible_data refactor
dcherian Aug 22, 2023
e70e98a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2023
a393d7f
duplicate sentinel value and leave the original sentinel object alone
andersy005 Aug 23, 2023
7b8316e
Apply suggestions from code review
andersy005 Aug 23, 2023
d74b802
use DuckArray
andersy005 Aug 23, 2023
acfdb90
Apply suggestions from code review
andersy005 Aug 23, 2023
d8b79eb
Merge branch 'main' into named-array
andersy005 Aug 23, 2023
2ece3c0
use sentinel value from xarray
andersy005 Aug 23, 2023
6fb79e6
remove unused code
andersy005 Aug 23, 2023
9545ca2
fix variable constructor
andersy005 Aug 23, 2023
e41a27c
fix as_compatible_data utility function
andersy005 Aug 23, 2023
259e0bd
move _to_dense and _non_zero to NamedArray
andersy005 Aug 23, 2023
a7ec770
more typing
andersy005 Aug 24, 2023
c55f35a
add initial tests
andersy005 Aug 24, 2023
2335bba
Merge branch 'main' into named-array
andersy005 Aug 30, 2023
34a262a
Apply suggestions from code review
andersy005 Aug 31, 2023
4b22b29
Merge branch 'main' into named-array
andersy005 Aug 31, 2023
790bfc2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 31, 2023
b909c87
Merge branch 'main' into pr/8075
Illviljan Sep 11, 2023
a31da00
attempt to fix some mypy errors
Illviljan Sep 11, 2023
b6c0af5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2023
b1e42aa
Update core.py
Illviljan Sep 11, 2023
45f9d99
Merge branch 'named-array' of https://github.com/andersy005/xarray in…
Illviljan Sep 11, 2023
2661001
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2023
b2a1cda
Update core.py
Illviljan Sep 11, 2023
d2971cc
Merge branch 'named-array' of https://github.com/andersy005/xarray in…
Illviljan Sep 11, 2023
b25a8ff
All input data can be arraylike
Illviljan Sep 11, 2023
06d77ad
Update core.py
Illviljan Sep 11, 2023
96ac4ec
Update core.py
Illviljan Sep 11, 2023
760cb48
get and set attrs at the same level.
Illviljan Sep 11, 2023
15c7300
data doesn't have to be ndarray
Illviljan Sep 11, 2023
bbe3db4
avoid redefining typing use new variable names instead
Illviljan Sep 11, 2023
2233662
import on runtime as well to be able to cast
Illviljan Sep 11, 2023
fb2ca4d
requires ufunc and function to be a valid duck array
Illviljan Sep 11, 2023
cf91823
Add array_namespace
Illviljan Sep 15, 2023
f21297b
Update test_dataset.py
Illviljan Sep 15, 2023
4fafb02
Update test_dataset.py
Illviljan Sep 15, 2023
c07fa0d
Merge branch 'main' into named-array
andersy005 Sep 15, 2023
c5fb91d
remove Frozen
andersy005 Sep 15, 2023
f2d3c95
Merge branch 'main' into named-array
andersy005 Sep 19, 2023
abc02c5
Merge branch 'main' into named-array
andersy005 Sep 19, 2023
4708ca2
update tests
andersy005 Sep 19, 2023
ff1b4de
update tests
andersy005 Sep 20, 2023
5455a44
Merge branch 'main' into named-array
andersy005 Sep 20, 2023
2162063
switch to functional API
andersy005 Sep 20, 2023
e530dd1
add fastpath
andersy005 Sep 20, 2023
9b3590c
Merge branch 'main' into named-array
andersy005 Sep 20, 2023
0f42857
Test making sizes dict[Hashable, int]
Illviljan Sep 20, 2023
afc7228
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2023
32ec4ea
A lot of errors... Try Mapping instead
Illviljan Sep 20, 2023
76bb881
Update groupby.py
Illviljan Sep 20, 2023
2d59cf5
Merge branch 'main' into named-array
andersy005 Sep 21, 2023
df77741
Update types.py
Illviljan Sep 21, 2023
8bf13b5
Apply suggestions from code review
andersy005 Sep 25, 2023
89a0010
Merge branch 'main' into named-array
andersy005 Sep 25, 2023
2f0192f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2023
3f22902
update docstrings
andersy005 Sep 25, 2023
f618625
update error messages
andersy005 Sep 25, 2023
94bf6c4
update tests
andersy005 Sep 25, 2023
0ec7876
test explicitly index array
andersy005 Sep 25, 2023
fb4ed12
update tests
andersy005 Sep 25, 2023
f0cfc11
remove unused types
andersy005 Sep 25, 2023
48fcf9b
Update xarray/tests/test_namedarray.py
andersy005 Sep 26, 2023
5f4e127
Merge branch 'main' into named-array
andersy005 Sep 26, 2023
2d9d7ff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2023
2ef5064
use Self
andersy005 Sep 26, 2023
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
2 changes: 1 addition & 1 deletion xarray/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def _get_axis_num(self: Any, dim: Hashable) -> int:
raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")

@property
def sizes(self: Any) -> Frozen[Hashable, int]:
def sizes(self: Any) -> Mapping[Hashable, int]:
"""Ordered mapping from dimension names to lengths.

Immutable.
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class GroupBy(Generic[T_Xarray]):

_groups: dict[GroupKey, GroupIndex] | None
_dims: tuple[Hashable, ...] | Frozen[Hashable, int] | None
_sizes: Frozen[Hashable, int] | None
_sizes: Mapping[Hashable, int] | None

def __init__(
self,
Expand Down Expand Up @@ -746,7 +746,7 @@ def __init__(
self._sizes = None

@property
def sizes(self) -> Frozen[Hashable, int]:
def sizes(self) -> Mapping[Hashable, int]:
"""Ordered mapping from dimension names to lengths.

Immutable.
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def dims(self) -> Frozen[Hashable, int] | tuple[Hashable, ...]:
...

@property
def sizes(self) -> Frozen[Hashable, int]:
def sizes(self) -> Mapping[Hashable, int]:
...

@property
Expand Down
Loading
Loading