Iris: Cube.is_compatible requires cell_methods to have the same order

Created on 13 Nov 2019  路  4Comments  路  Source: SciTools/iris

On this line: https://github.com/SciTools/iris/blob/b2ce2a34e2eef7e3d6203c77ada7ed4ce89e3145/lib/iris/cube.py#L918 cell methods is compared in a way which seems like it cares about the order of the cell methods. It may be more appropriate to check equality in a way which ignores order (perhaps by comparing sets).

Most helpful comment

In general, I believe cell methods are not commutable, e.g. taking the mean over time of a standard deviation over area vs. a standard deviation over area of a mean over time. Hence, the order of cell methods is important.

All 4 comments

@stephenworsley The iris.coords.CellMethod is not very rich in functionality, even through it's been around for a while.

This certainly seems like a reasonable approach to take to make the equality more robust i.e., independent of order - which shouldn't make a difference.

While you鈥檙e in there, I have a question about this method at #2992. Perhaps the docstring can be improved for clarification?

In general, I believe cell methods are not commutable, e.g. taking the mean over time of a standard deviation over area vs. a standard deviation over area of a mean over time. Hence, the order of cell methods is important.

@rhattersley Thanks, that's good to know.

Was this page helpful?
0 / 5 - 0 ratings