Coder Social home page Coder Social logo

Comments (6)

jreadey avatar jreadey commented on June 25, 2024

I've implemented some fixes for this in h5serv - please update your h5serv repo and try it out.
My change always returns an absolute DNS-style name. Relative filenames should be ok.
It should also work with absolute filenames in the link that point to the correct location in the server data directory. Again it will return a DNS name.

There are a bunch of edge cases, but I think this should be good for common usage.

from h5pyd.

rayosborn avatar rayosborn commented on June 25, 2024

It works, although it is tripped up if the external file has a different extension than the default server extension. In my example, the file mullite/mullite_300K.h5 has an external link to 300K/transform.nxs. With .h5 as the default extension, I get:

>>> import h5pyd as h5
>>> a=h5.File('mullite_300K.mullite.exfac', mode='r', endpoint='http://34.193.81.207:5000')
>>> a['/entry/transform/v']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-c6429c132039> in <module>()
----> 1 a['/entry/transform/v']

/Users/rosborn/anaconda/envs/py27/lib/python2.7/site-packages/h5pyd/_hl/group.pyc in __getitem__(self, name)
    349             except IOError:
    350                 # unable to find external link
--> 351                 raise KeyError("Unable to open file: " + link_json['h5domain'])
    352             return f[link_json['h5path']]
    353 

KeyError: u'Unable to open file: transform.nxs.300K.mullite.exfac'

So the non-default extension, .nxs is being included in the filename. If I rename the parent file to mullite/mullite_300K.nxs and restart the server with .nxs as the default extension, i.e., so it matches the extension of the linked file, then it works:

>>> a['/entry/transform/v']
<HDF5 dataset "v": shape (801, 901, 901), type "<f4">
>>> a.filename
 'mullite_300K.mullite.exfac'
>>> a['/entry/transform/v'].file
<HDF5 file "transform.300K.mullite.exfac" (mode r)>

from h5pyd.

rayosborn avatar rayosborn commented on June 25, 2024

There seems to be another problem. If a group contains an externally linked dataset and I call the group's items() method, the external link does not get resolved in the returned value, even though it does get resolved when referencing the dataset directly.

>>> a=h5.File('mullite_300K.mullite.exfac', mode='r', endpoint='http://34.193.81.207:5000')
>>> a['/entry/transform'].items()
[(u'Qk', <HDF5 dataset "Qk": shape (901,), type "<f8">),
 (u'Ql', <HDF5 dataset "Ql": shape (801,), type "<f8">),
 (u'Qh', <HDF5 dataset "Qh": shape (901,), type "<f8">),
 (u'v', None)] 
>>> a['/entry/transform/v']
<HDF5 dataset "v": shape (801, 901, 901), type "<f4">

from h5pyd.

jreadey avatar jreadey commented on June 25, 2024

Ah, looks like I did the transform for the link operation, but not the links one.
I've fixed that now, update your h5serv repo.

from h5pyd.

rayosborn avatar rayosborn commented on June 25, 2024

The items function now returns all the values, including the external links. Fixing this has uncovered another possible inconsistency with h5py, which I will post as another issue. Thanks for all the work.

from h5pyd.

jreadey avatar jreadey commented on June 25, 2024

Good. I'll close this one then.

from h5pyd.

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.