Skip to content

Commit fe03650

Browse files
Merge pull request #718 from jbusecke/remove-ds.dims-warning
Crush warning about ds.dims deprecation
2 parents 055dbf1 + 4d6c936 commit fe03650

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pangeo_forge_recipes/rechunking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ def split_fragment(
5757
dimsize = getattr(index[concat_dim], "dimsize", 0)
5858
concat_position = index[concat_dim]
5959
start = concat_position.value
60-
stop = start + ds.dims[dim_name]
60+
stop = start + ds.sizes[dim_name]
6161
dim_slice = slice(start, stop)
6262
rechunked_concat_dims.append(concat_dim)
6363
else:
6464
# If there is a target_chunk that is NOT present as a concat_dim
6565
# in the fragment index, then we can assume that the entire span of
6666
# that dimension is present in the dataset.
6767
# This would arise e.g. when decimating a contiguous dimension
68-
dimsize = ds.dims[dim_name]
68+
dimsize = ds.sizes[dim_name]
6969
dim_slice = slice(0, dimsize)
7070

7171
target_chunks_and_dims[dim_name] = (chunk, dimsize)

tests/test_rechunking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_split_multidim():
142142

143143
nt = 2
144144
ds = make_ds(nt=nt)
145-
nlat = ds.dims["lat"]
145+
nlat = ds.sizes["lat"]
146146
dimension = Dimension("time", CombineOp.CONCAT)
147147
index = Index({dimension: IndexedPosition(0, dimsize=nt)})
148148

@@ -211,7 +211,7 @@ def test_combine_fragments_multidim(time_chunk, lat_chunk):
211211

212212
nt = 10
213213
ds = make_ds(nt=nt)
214-
ny = ds.dims["lat"]
214+
ny = ds.sizes["lat"]
215215

216216
fragments = []
217217
time_dim = Dimension("time", CombineOp.CONCAT)

tests/test_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_rechunk(
209209
def correct_chunks():
210210
def _check_chunks(actual):
211211
for index, ds in actual:
212-
actual_chunked_dims = {dim: ds.dims[dim] for dim in target_chunks}
212+
actual_chunked_dims = {dim: ds.sizes[dim] for dim in target_chunks}
213213
assert all(
214214
position.indexed
215215
for dimension, position in index.items()

0 commit comments

Comments
 (0)