Giter VIP home page Giter VIP logo

Comments (9)

rimmartin avatar rimmartin commented on July 22, 2024

native hdf5 1.10?
hdf5.node 0.3.1?
They are wrapped in an Int64 object in the latest versions. If you continue you would see it gets the next child members

const members2       = group.getMemberNames();
console.dir(members2);

yields [ 'OSBS' ]

I'll look into adding to the toString of Int64 to display the value yet the user should never need to operate on these values without the wrapper. I did this because hdf5 1.10 went to 64 bit id's and javascript doesn't support such a large bit field for integers

from hdf5.node.

rimmartin avatar rimmartin commented on July 22, 2024

Now

console.log(file.id.toString());
console.log(group.id.toString());

does display the id as a string since there is no javascript 64 bit integer

from hdf5.node.

tonyferreira avatar tonyferreira commented on July 22, 2024

I tried to npm install the 0.3.2 package straight from Github, but the install threw an error in node-gyp, so I tried again with the 0.3.1 package.

Running on Node

~ » node -v                                                                                                                                              
v7.5.0

brew formula for natives

~ » brew info hdf5                                                                                                                                       
homebrew/science/hdf5: stable 1.10.0-patch1 (bottled)

0.3.1 of hdf5.node

~ » npm view hdf5 version                                                                                                                                
0.3.1

When I run the following to open a dataset

const file      = new hdf5.File('NEONDSTowerTemperatureData.hdf5', Access.ACC_RDONLY);
const boom_3    = file.openGroup(`Domain_10/STER/min_30/boom_3/`);
const ds        = h5lt.readDataset(boom_3.id, 'temperature');

I get

const ds = h5lt.readDataset(boom_3.id, 'temperature');       
SyntaxError: unsupported data type
    at Object.<anonymous> (<path to js file omitted>)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:533:3

from hdf5.node.

rimmartin avatar rimmartin commented on July 22, 2024

You'll need the table interface: http://hdf-ni.github.io/hdf5.node/ref/tables.html. Nice set of data in tabular form.

const h5tb        = require('hdf5').h5tb;

....
var boom_3    = file.openGroup(`Domain_10/STER/min_30/boom_3/`);
var temperatureTable=h5tb.readTable(boom_3.id, "temperature");
console.dir(temperatureTable);

If you are working with an unknown hierarchy you can find out what it is with

var HLType = require('hdf5/lib/globals.js').HLType;

...
var hlType=boom_3.getDatasetType("temperature");
switch(hlType){
    case HLType.HL_TYPE_LITE:
        break;
    case HLType.HL_TYPE_IMAGE:
        break;
    case HLType.HL_TYPE_TABLE:
        console.dir("I'm a table.");
        break;
    case HLType.HL_TYPE_PACKET_TABLE:
        break;
    case HLType.HL_TYPE_DIMENSION_SCALES:
        break;
    case HLType.HL_TYPE_OPTIMIZED_FUNCTIONS:
        break;
    case HLType.HL_TYPE_EXTENSIONS:
        break;
    default: //HL_TYPE_UNKNOWN
        break;
}

yields
'I'm a table.'
http://hdf-ni.github.io/hdf5.node/ref/globals.html#hltype

from hdf5.node.

rimmartin avatar rimmartin commented on July 22, 2024
for(var column in temperatureTable){
    console.dir(temperatureTable[column].name);
}

yields
'date'
'numPts'
'mean'
'min'
'max'
'variance'
'stdErr'
'uncertainty'

from hdf5.node.

tonyferreira avatar tonyferreira commented on July 22, 2024

Thank you for the quick responses. I was able to retrieve the datasets from the sample file using h5tb.readTable, however, I'm getting a node abort when trying to read datasets from the following file:

20170331.h5.zip

const h5lt     = require('hdf5').h5lt;
const H5OType  = require('hdf5/lib/globals.js').H5OType;
const HLType   = require('hdf5/lib/globals.js').HLType;
const Access   = require('hdf5/lib/globals').Access;
const hdf5     = require('hdf5').hdf5;
const h5tb     = require('hdf5').h5tb;
const file     = new hdf5.File('20170331.h5', Access.ACC_RDONLY);
const group    = file.openGroup('ROOT/PARAMS/A1/');
const data     = h5tb.readTable(group.id, 'Values');

console.dir(data);

Node:

[1] 67409 abort node <filename>.js

from hdf5.node.

rimmartin avatar rimmartin commented on July 22, 2024

I tested with nodejs v7.5.0 & hdf5 native hdf5-1.10.0-patch1

Reading it successfully. Not sure what the error means.
try a try catch

try{
    const file     = new hdf5.File('20170331.h5', Access.ACC_RDONLY);
    const group    = file.openGroup('ROOT/PARAMS/A1/');
    const data     = h5tb.readTable(group.id, 'Values');
catch(err) {
   console.dir(err.message);
}

from hdf5.node.

rimmartin avatar rimmartin commented on July 22, 2024

when pulling directly from github in your package json's dependencies have

    "hdf5" : "HDF-NI/hdf5.node"

then your npm line needs to tell it where hdf5 native is

npm install –hdf5_home_mac=<your hdf5 base directory>

where this is your dependent project's install

from hdf5.node.

tonyferreira avatar tonyferreira commented on July 22, 2024

Thanks for looking into it. Looks like it's specific to my system. I'm running macOS Sierra 10.12.3 with the brew version of the natives. I'll try it on a windows machine.

from hdf5.node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.