Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 53dd28f

Browse files
committed
Merge branch 'develop'
2 parents 2ab4171 + ed014b2 commit 53dd28f

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

ecml_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# granted to it by virtue of its status as an intergovernmental organisation
66
# nor does it submit to any jurisdiction.
77

8-
__version__ = "0.4.2"
8+
__version__ = "0.4.5"

ecml_tools/data.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ def _make_slice_or_index_from_list_or_tuple(indices):
6969
"""
7070
Convert a list or tuple of indices to a slice or an index, if possible.
7171
"""
72-
if len(indices) == 1:
73-
return indices[0]
72+
73+
if len(indices) < 2:
74+
return indices
7475

7576
step = indices[1] - indices[0]
7677

@@ -660,10 +661,10 @@ def __len__(self):
660661
@expand_list_indexing
661662
def _get_tuple(self, index):
662663
index, changes = index_to_slices(index, self.shape)
663-
print(index, changes)
664+
# print(index, changes)
664665
lengths = [d.shape[0] for d in self.datasets]
665666
slices = length_to_slices(index[0], lengths)
666-
print("slies", slices)
667+
# print("slies", slices)
667668
result = [
668669
d[update_tuple(index, 0, i)[0]]
669670
for (d, i) in zip(self.datasets, slices)
@@ -942,12 +943,12 @@ def _get_slice(self, s):
942943
@expand_list_indexing
943944
def _get_tuple(self, n):
944945
index, changes = index_to_slices(n, self.shape)
946+
# print('INDEX', index, changes)
945947
indices = [self.indices[i] for i in range(*index[0].indices(self._len))]
946-
index, previous = update_tuple(
947-
index, 0, _make_slice_or_index_from_list_or_tuple(indices)
948-
)
948+
indices = _make_slice_or_index_from_list_or_tuple(indices)
949+
# print('INDICES', indices)
950+
index, _ = update_tuple(index, 0, indices)
949951
result = self.dataset[index]
950-
result = result[previous]
951952
result = apply_index_to_slices_changes(result, changes)
952953
return result
953954

tests/test_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def test_rename():
639639
),
640640
start_date=datetime.datetime(2021, 1, 1),
641641
time_increment=datetime.timedelta(hours=6),
642-
statistics_reference_dataset="test-2021-2021-6h-o96-abcd",
642+
statistics_reference_dataset=None,
643643
statistics_reference_variables=None,
644644
)
645645

@@ -1144,4 +1144,4 @@ def test_statistics():
11441144

11451145

11461146
if __name__ == "__main__":
1147-
test_ensemble_1()
1147+
test_subset_1()

0 commit comments

Comments
 (0)