Skip to content

Commit 4f023d6

Browse files
committed
aggregating_axes
1 parent 602f74a commit 4f023d6

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

cf/aggregate.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,15 +3492,15 @@ def climatology_cells(
34923492

34933493

34943494
def _create_hash_and_first_values(
3495-
meta, axes, donotchecknonaggregatingaxes, hfl_cache, rtol, atol
3495+
meta, aggregating_axes, donotchecknonaggregatingaxes, hfl_cache, rtol, atol
34963496
):
34973497
"""Updates each field's _Meta object.
34983498
34993499
:Parameters:
35003500
35013501
meta: `list` of `_Meta`
35023502
3503-
axes: `list`
3503+
axes: sequence
35043504
The identities of the possible aggregating axes.
35053505
35063506
donotchecknonaggregatingaxes: `bool`
@@ -3514,8 +3514,6 @@ def _create_hash_and_first_values(
35143514
# identity.
35153515
canonical_direction = {}
35163516

3517-
aggregating_axes = list(axes)
3518-
35193517
for m in meta:
35203518
field = m.field
35213519
constructs = field.constructs.todict()
@@ -3541,9 +3539,9 @@ def _create_hash_and_first_values(
35413539
# --------------------------------------------------------
35423540
for identity in m.axis_ids:
35433541
if (
3544-
axes is not None
3542+
aggregating_axes is not None
35453543
and donotchecknonaggregatingaxes
3546-
and identity not in axes
3544+
and identity not in aggregating_axes
35473545
):
35483546
x = [None] * len(m.axis[identity]["keys"])
35493547
m_hash_values[identity] = x
@@ -3685,12 +3683,12 @@ def _create_hash_and_first_values(
36853683

36863684
coord = constructs[key]
36873685

3688-
axes = aux["axes"]
3686+
c_axes = aux["axes"]
36893687
canonical_axes = aux["canonical_axes"]
3690-
if axes != canonical_axes:
3688+
if c_axes != canonical_axes:
36913689
# Transpose the N-d auxiliary coordinate so that
36923690
# it has the canonical axis order
3693-
iaxes = [axes.index(axis) for axis in canonical_axes]
3691+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
36943692
coord = coord.transpose(iaxes)
36953693

36963694
sort_indices, needs_sorting = _sort_indices(m, canonical_axes)
@@ -3736,14 +3734,14 @@ def _create_hash_and_first_values(
37363734
else:
37373735
for canonical_units, msr in m.msr.items():
37383736
hash_values = []
3739-
for key, axes, canonical_axes in zip(
3737+
for key, c_axes, canonical_axes in zip(
37403738
msr["keys"], msr["axes"], msr["canonical_axes"]
37413739
):
37423740
cell_measure = constructs[key]
3743-
if axes != canonical_axes:
3741+
if c_axes != canonical_axes:
37443742
# Transpose the cell measure so that it has
37453743
# the canonical axis order
3746-
iaxes = [axes.index(axis) for axis in canonical_axes]
3744+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
37473745
cell_measure = cell_measure.transpose(iaxes)
37483746

37493747
sort_indices, needs_sorting = _sort_indices(
@@ -3850,12 +3848,12 @@ def _create_hash_and_first_values(
38503848

38513849
field_anc = constructs[key]
38523850

3853-
axes = anc["axes"]
3851+
c_axes = anc["axes"]
38543852
canonical_axes = anc["canonical_axes"]
3855-
if axes != canonical_axes:
3853+
if c_axes != canonical_axes:
38563854
# Transpose the field ancillary so that it has the
38573855
# canonical axis order
3858-
iaxes = [axes.index(axis) for axis in canonical_axes]
3856+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
38593857
field_anc = field_anc.transpose(iaxes)
38603858

38613859
sort_indices, needs_sorting = _sort_indices(m, canonical_axes)
@@ -3888,12 +3886,12 @@ def _create_hash_and_first_values(
38883886

38893887
domain_anc = constructs[key]
38903888

3891-
axes = anc["axes"]
3889+
c_axes = anc["axes"]
38923890
canonical_axes = anc["canonical_axes"]
3893-
if axes != canonical_axes:
3891+
if c_axes != canonical_axes:
38943892
# Transpose the domain ancillary so that it has
38953893
# the canonical axis order
3896-
iaxes = [axes.index(axis) for axis in canonical_axes]
3894+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
38973895
domain_anc = domain_anc.transpose(iaxes)
38983896

38993897
sort_indices, needs_sorting = _sort_indices(m, canonical_axes)

0 commit comments

Comments
 (0)