Skip to content

Commit 67294b4

Browse files
committed
dev
1 parent e3183da commit 67294b4

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

cf/aggregate.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class _Meta:
210210
(
211211
"Type",
212212
"Identity",
213+
"featureType",
213214
"Units",
214215
"Cell_methods",
215216
"Data",
@@ -389,6 +390,8 @@ def __init__(
389390
if field_identity:
390391
self.identity = f.get_property(field_identity, None)
391392

393+
self.featureType = f.get_property('featureType', None)
394+
392395
construct_axes = f.constructs.data_axes()
393396

394397
# ------------------------------------------------------------
@@ -1560,6 +1563,9 @@ def coord_has_identity_and_data(self, coord, axes=None):
15601563
default=None,
15611564
)
15621565

1566+
if self.featureType and coord.get_property('cf_role', None):
1567+
print(11111, repr(coord))
1568+
15631569
if identity is not None:
15641570
all_coord_identities = self.all_coord_identities.setdefault(
15651571
axes, set()
@@ -1773,6 +1779,9 @@ def structural_signature(self):
17731779
Cell_methods = self.cell_methods
17741780
Data = self.has_field_data
17751781

1782+
# FeatureType
1783+
featureType = self.featureType
1784+
17761785
# Properties
17771786
Properties = self.properties
17781787

@@ -1918,6 +1927,7 @@ def structural_signature(self):
19181927
self.signature = self._structural_signature(
19191928
Type=Type,
19201929
Identity=Identity,
1930+
featureType=featureType,
19211931
Units=Units,
19221932
Cell_methods=Cell_methods,
19231933
Data=Data,
@@ -4132,6 +4142,9 @@ def _hash_values(m):
41324142

41334143
hash0 = hash1
41344144

4145+
if m0.featureType and not count:
4146+
print(9999999999999)
4147+
41354148
if count == 1:
41364149
# --------------------------------------------------------
41374150
# Exactly one axis has different 1-d coordinate values
@@ -4233,10 +4246,24 @@ def _hash_values(m):
42334246
# aggregate anything in this entire group.
42344247
# --------------------------------------------------------
42354248
if info:
4249+
coord_ids = []
4250+
for k, v in m0.axis.items():
4251+
coord_ids.extend([repr(i) for i in v['ids']])
4252+
4253+
if len(coord_ids) > 1:
4254+
coord_ids = (
4255+
f"{', '.join(coord_ids[:-1])} and {coord_ids[-1]}"
4256+
)
4257+
elif coord_ids:
4258+
coord_ids = coord_ids[0]
4259+
else:
4260+
coord_ids = ""
4261+
42364262
meta[
42374263
0
42384264
].message = (
4239-
"Some fields have identical sets of 1-d coordinates."
4265+
f"Some fields have identical sets of 1-d {coord_ids} "
4266+
"coordinates."
42404267
)
42414268

42424269
return ()

0 commit comments

Comments
 (0)