HDF-NI / hdf5.node

A node module for reading/writing the HDF5 file format.
MIT License
123 stars 40 forks source link

Reading attributes from datasets returns weird results #52

Closed bsrdjan closed 6 years ago

bsrdjan commented 6 years ago

The same issue like for groups attributes (https://github.com/HDF-NI/hdf5.node/issues/28), I am facing for dataset attributes, get values which look corrupted. I can provide the sample and more info if needed?

rimmartin commented 6 years ago

Yea anything that gives me an idea of what is going on would help; I will work on this project on the weekend(work days are loaded)

rimmartin commented 6 years ago

It's an array of variable sized strings?

bsrdjan commented 6 years ago

Thank you so much @rimmartin for your work on this module and fast response.

Please find sample data attached and the output of reading attribute with group.getDatasetAttributes:

scada/active_power
{ initial_time: '�c@\u0003\u0001',
  time_step: '�`@\u0003\u0001',
  unit: '�w@\u0003\u0001' }

scada/generator_speed
{ initial_time: '��@\u0003\u0001',
  time_step: '',
  unit: 'P�@\u0003\u0001' }

sample.zip

rimmartin commented 6 years ago

Ok, we'll see over the weekend

rimmartin commented 6 years ago

It's reading from your sample.h5 now. Thanks for it. I haven't published to npm yet; you can use "hdf5": "HDF-NI/hdf5.node", in your project's package.json to pull it from github. If you need it published I'll do it in the next couple of days.

bsrdjan commented 6 years ago

Thanks @rimmartin, experimental release is just fine.

Installation works on Linux and fails on OSX, probably because of the compiler flag required for "mac":

../src/h5_file.cc:201:22: error: extra tokens at end of #ifdef directive [-Werror,-Wextra-tokens]
#ifdef  H5_VERSION_GE(1,10,0)
                     ^
                     //
1 error generated.
rimmartin commented 6 years ago

Ah that is something new I was adding for Single-Write-Multi-Read enabling for 1.10.x versions; I'll test on a mac tonight as well if it skips that code for 1.8.x version of node

rimmartin commented 6 years ago

I commented the #ifdef H5_VERSION_GE(1,10,0) segement temporarily so it should build on darwin

bsrdjan commented 6 years ago

Thank you @rimmartin . I tested and got following output on Mac now:

  CXX(target) Release/obj.target/hdf5/src/h5_group.o
  SOLINK_MODULE(target) Release/h5im.node
  SOLINK_MODULE(target) Release/h5pt.node
  SOLINK_MODULE(target) Release/h5ds.node
../src/methods.cc:581:40: error: unused variable 'idx' [-Werror,-Wunused-variable]
      hsize_t                          idx = args[0]->Int32Value();
                                       ^
../src/methods.cc:583:36: error: unused variable 'argc' [-Werror,-Wunused-variable]
      const unsigned               argc = 2;
                                   ^
2 errors generated.
make: *** [Release/obj.target/hdf5/src/methods.o] Error 1
make: *** Waiting for unfinished jobs....
../src/h5_file.cc:201:11: error: unused variable 'file' [-Werror,-Wunused-variable]
    File* file = ObjectWrap::Unwrap<File>(args.This());
          ^
1 error generated.
rimmartin commented 6 years ago

ah warnings are set to error; let me comment that out or move it within the commneted segment...

rimmartin commented 6 years ago

pushed another try

rimmartin commented 6 years ago

oh there are more ok wait ...

rimmartin commented 6 years ago

ok got all three

bsrdjan commented 6 years ago

Thanks, it works for me now, both the installation and dataset attributes reading.