Skip to content

fix: compute_time_derivative crashes with IndexError on single-frame data #913

@PewterZz

Description

@PewterZz

compute_velocity and other kinematic functions crash with IndexError: index 0 is out of bounds for axis 0 with size 0 when the input has only one time frame. The error comes from numpy's gradient function inside xarray.differentiate, which needs at least 2 points. A guard in compute_time_derivative would catch this early with a clear message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🤔 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions