Skip to content

Coords do not support basic arthimetic #566

@d-chambers

Description

@d-chambers

Description

DASCore's coordinates should behave like arrays for arithmetic purposes, but they currently do not.

Example

coord = dc.get_coord(data=[1,2,3,])
coord + 1  # Raises a TypeError

Expected behavior

Coords should act just like arrays in these respects, although any arithmetic operation should return a coordinate (which preserves units) not an array. For example,

import dascore as dc

coord =dc.get_coord([1,2,3], units='m')
coord_2 = coord + 1
assert isinstance(coord, dc.BaseCoordinate)
assert coord.units == coord_2.units

This should also be tested on a variety of array functions (plus, minus, np.linalg.norm, np.sqrt, etc).

Versions

  • OS [e.g. Ubuntu 20.04]:
  • DASCore Version [e.g. 0.0.5]:
  • Python Version [e.g. 3.10]:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions