Skip to content

compatibility with numpy>2.0 #74

Description

@matthewpendleton

numpy >2.0 is not backwards compatible, and specifically fails in the endian/byteorder check. An updated implementation (along with explicitly specifying the proper endianness) that is compliant with the changes made in numpy 2.0 and later would be:

        # Convert to native byte order
        # This is needed for working with pandas data structures
        sys_is_le = sys.byteorder == 'little'
        native_code = '<' if sys_is_le else '>'
        swapped_code = '>' if sys_is_le else '<'
        if endian != native_code:
            # swaps the actual bytes and also the endianness
            # updated to be numpy>= 2.0 compliant
            data = data.view(data.dtype.newbyteorder(swapped_code)).byteswap()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions