Skip to content

Cpf fails with torch due to slicing with negative strides #73

@sandorkertesz

Description

@sandorkertesz

What happened?

test_cpf_core fails with this input/options when the array format is torch:

(_cpf.cpf_clim3, _cpf.cpf_ens3, dict(sort_clim=True, symmetric=True), _cpf.cpf_val3), # sym

        if symmetric:
>           cpf_reverse = _cpf(-clim[::-1, :], -ens[::-1, :], from_zero=from_zero)
                                ^^^^^^^^^^^^^
E           ValueError: step must be greater than zero

src/earthkit/meteo/extreme/array/cpf.py:150: ValueError

The reason is that slicing with negative strides is not supported in torch.

What are the steps to reproduce the bug?

See above

Version

0.5.0

Platform (OS and architecture)

Any

Relevant log output

Accompanying data

No response

Organisation

ECMWF

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