-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, unary operation do not apply to bounds, but equivalent binary operations do:
>>> f = cf.example_field(0)
>>> a = f.dimension_coordinate('X')
>>> a.bounds.array
array([[ 0., 45.],
[ 45., 90.],
[ 90., 135.],
[135., 180.],
[180., 225.],
[225., 270.],
[270., 315.],
[315., 360.]])
b = -1 * a
>>> b.bounds.array
array([[ -0., -45.],
[ -45., -90.],
[ -90., -135.],
[-135., -180.],
[-180., -225.],
[-225., -270.],
[-270., -315.],
[-315., -360.]])
>>> c = -a
>>> c.bounds.array
array([[ 0., 45.],
[ 45., 90.],
[ 90., 135.],
[135., 180.],
[180., 225.],
[225., 270.],
[270., 315.],
[315., 360.]])This is inconsistent. I propose making the arithmetic (as opposed to bitwise) unary operators also apply to bounds, when present, i.e. __abs__, __neg__, and __pos__ only.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request