Skip to content

Commit bb046b5

Browse files
committed
Minor updates
1 parent 3b5fb94 commit bb046b5

13 files changed

+22
-9
lines changed

XarrayActive/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .active_xarray import ActiveDataset # Used by CFAPyX
2-
from .active_dask import DaskActiveArray # Used by CFAPyX
3-
from .active_chunk import ActiveChunk # Used by CFAPyX
4-
from .backend import ActiveBackendEntrypoint
1+
from XarrayActive.active_xarray import ActiveDataset # Used by CFAPyX
2+
from XarrayActive.active_dask import DaskActiveArray # Used by CFAPyX
3+
from XarrayActive.active_chunk import ActiveChunk # Used by CFAPyX
4+
from XarrayActive.backend import ActiveBackendEntrypoint
376 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3.88 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

XarrayActive/active_chunk.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def active_options(self, value):
2323

2424
def _set_active_options(self, chunks={}, chunk_limits=True):
2525

26-
if chunks == {}:
26+
27+
if chunks == {} and False: # Remove for testing
2728
raise NotImplementedError(
2829
'Default chunking is not implemented, please provide a chunk scheme '
2930
' - active_options = {"chunks": {}}'
@@ -106,13 +107,18 @@ def active_method(self, method, axis=None, skipna=None, **kwargs):
106107

107108
if not ret:
108109

110+
# Create Active client
109111
active = Active(self.filename, self.address)
110112
active.method = method
113+
114+
# Fetch extent for this chunk instance.
111115
extent = tuple(self.get_extent())
112116

117+
# Properly format the 'axis' kwarg.
113118
if axis == None:
114119
axis = tuple([i for i in range(self.ndim)])
115120

121+
# Determine reduction parameter for combining chunk results for dask.
116122
n = self._numel(method, axes=axis)
117123

118124
if len(axis) == self.ndim:

XarrayActive/wrappers.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
get_chunk_positions,
77
get_chunk_extent,
88
get_dask_chunks,
9-
combine_slices
9+
combine_slices,
10+
normalize_partition_chunks
1011
)
1112
from .active_chunk import (
1213
ActiveChunk,
@@ -64,6 +65,12 @@ def __init__(
6465

6566
super().__init__(shape, units=units, dtype=dtype)
6667

68+
self._active_chunks = normalize_partition_chunks(
69+
self._active_chunks,
70+
self.shape,
71+
self.dtype,
72+
self.named_dims)
73+
6774
self.chunk_shape = get_chunk_shape(
6875
self._active_chunks,
6976
self.shape,
@@ -141,4 +148,4 @@ def __array__(self, *args, **kwargs):
141148
explicit_shapes=None
142149
)
143150

144-
return DaskActiveArray(dsk, array_name[0], chunks=dask_chunks, dtype=self.dtype)
151+
return DaskActiveArray(dsk, array_name[0], chunks=dask_chunks, dtype=self.dtype)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ authors = [{name = "Daniel Westwood", email = "daniel.westwood@stfc.ac.uk"}]
1616
packages = ["XarrayActive"]
1717

1818
[project.entry-points."xarray.backends"]
19-
Active = "XarrayActive:ActiveBackendEntrypoint"
19+
Active = "XarrayActive.backend:ActiveBackendEntrypoint"

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ dask==2024.7.0
88
cftime==1.6.4
99
cfunits==3.3.7
1010
pytest==7.2.0
11-
ArrayPartition==1.0
11+
ArrayPartition==1.0.1

0 commit comments

Comments
 (0)