hdf-compass icon indicating copy to clipboard operation
hdf-compass copied to clipboard

View int8 and uin8 Data as binary string or encoded string

Open hernot opened this issue 4 years ago • 0 comments

In python strings may be stored as encoded bytearray which in contrast to \0 terminated byte stringscan be compressed. The resulting 8 bit integer dataset is displayed as such by hdf-compas. Which makes inspections of such datasets a bit difficult. Therefore i do suggests to enhace dataset view for 8bit integer type datasets by providing alternative views like the following crude examples:

binary ....... view as plain binary bytes eg. print(bytearray(eight_bit_int_dataset[()]))

hex .......... view as hexstring instead eg. print("{:x}".format(eight_bit_int_dataset[()]))

<encoding> ... view as decoded bytarray content eg.
      selected_encoding="utf8"
      print(bytearray(eight_bit_int_dataset[()]).decode(selected_encoding))

That would allow to inspect hdf5 which encodes strings in eight bit int datasets instead of \0 terminated c-style string datasets.

NOTE as python2 is out of support this feature request shall only affect python3 branch #186

hernot avatar Aug 14 '20 19:08 hernot