ComputationalRadiationPhysics / libSplash

libSplash - Simple Parallel file output Library for Accumulating Simulation data using Hdf5
GNU Lesser General Public License v3.0
15 stars 15 forks source link

Bool: CAPS Enum Labels for h5py #198

Closed ax3l closed 9 years ago

ax3l commented 9 years ago

Else it does not identify those as bool_ but as int8. Regression for #153 (still in dev).

h5py representation since #153 (example for a False value):

scalar attribute: (1, <type 'numpy.int8'>)

data set: <HDF5 dataset "data_bool": shape (7, 7, 7), type "|i1">,
          <class 'h5py._hl.dataset.Dataset'>,
          dtype([(({'vals': {'true': 1, 'false': 0}}, 'enum'), 'i1')])

and now (same enum but with different label):

scalar attribute: False, <type 'numpy.bool_'>

data set: <HDF5 dataset "data_bool": shape (7, 7, 7), type "|b1">,
          <class 'h5py._hl.dataset.Dataset'>,
          dtype('bool')

Increases format by a minor since the structure is still the same but the identification in h5py is improved (and it is still not in a stable release).

To Do

ax3l commented 9 years ago

@PrometheusPi in case you are using the dev of libSplash with h5py this will change your variables from 0/1 to False/True representation. An if( var ) should cover both cases.

Remember, that the latest release of libSplash (1.2.4) does not yet support h5py compatible bool types.

PrometheusPi commented 9 years ago

@ax3l thanks for informing, yes I am using the dev.