NCAS-CMS / cf-python

A CF-compliant Earth Science data analysis library
http://ncas-cms.github.io/cf-python
MIT License
127 stars 19 forks source link

`cyclic`: different sets for `Field.domain` & corresponding `Field` #762

Closed sadielbartholomew closed 7 months ago

sadielbartholomew commented 7 months ago

During work towards a fix for #758 I have noticed that the set returned from cyclic() for a Domain is, at least in some cases such as the example below (namely example field no. 2), not the same as the set for the corresponding Field i.e. <a Field>.domain.cyclic() and <a Field>.cyclic() are not equal in terms of size as well as named keys. However, they should be the same, at least with respect to the number of axes present regardless of keyed names, because axes of a Field's domain are, by contextual definition, the same as the axes of that Field.

Concrete example

>>> f = cf.example_field(2)
>>> f.cyclic()
{'domainaxis2'}
>>> d = f.domain
>>> d.cyclic()
set()
sadielbartholomew commented 7 months ago

(Just trying to find a good Issue name which fits into one line only as a PR header... :slightly_smiling_face: )