Skip to content

Cube broadcasting for addition/subtraction. #1887

@rcomer

Description

@rcomer

As @shoyer noted at PR #888, the cube broadcasting rules for addition and subtraction are different (more strict) than for multiplication and division. Lines 260-279 in iris.analysis.maths have the extra add/subtract checks. This has caught me out a few times when trying to take differences between very similar cubes.

For example, today the subtract threw an error with This operation cannot be performed as there are differing coordinates (latitude, longitude) remaining which cannot be ignored. It took some digging to realise that the only difference was that var_name was set for both coords on only one of the cubes.

I'm wondering if these extra checks for addition and subtraction could simply be removed. There is a specific (old) test, so the behaviour is obviously deliberate. I don't understand why though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions