Skip to content

stft fails unit coercion with a timedelta64 coordinate #604

@d-chambers

Description

@d-chambers

When the time dimension is timedelta64 type rather than datetime64 the value specified in stft must be a timedelta64, but it should also support a float/int value which gets converted into a timedelta64. When the time coordinate is a datetime64 this works as intended.

Example

import dascore as dc

patch = dc.get_example_patch()

time = patch.get_coord("time")

new = patch.update_coords(time=time.values - time.values[-1])

new.stft(time=.1)  # Raises an error

new.stft(time=dc.to_timedelta64(.1))  # works

Also, the time coordinate seems to be wrong on the transform in this case.

Expected behavior

Versions

  • OS [e.g. Ubuntu 20.04]:
  • DASCore Version [e.g. 0.0.5]: Master branch
  • 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