Skip to content

String encoding in structured metadata arrays #3097

Open
@benjeffery

Description

@benjeffery

#3091 introduced returning a numpy structured array from a compatible metadata buffer. The StructCodec allows the specification of string encoding in the schema, however numpy only supports bytes and utf-32 in S and U dtypes. #3091 therefore returns structured arrays with only the S dtype for each string field.

At the cost of a copy and some shuffling, it would be possible to decode these to the users specification in the schema using numpy.char.decode then reassigning the encoded string array back into the structured array. This could be implemented as an option with a boolean flag decode_strings to structured_array_from_buffer, however as ts.X_metadata is a property this couldn't be set when retrieving the array, so either an additional property on the ts (ts.X_metadata_string_decode?) or leaving the user to do this via the lower-level code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions