Code Monkey home page Code Monkey logo

h5cat's Introduction

h5cat: preview the contents of HDF5 files in the command line.

h5cat is a Python script to quickly preview the contents of an HDF5 file. It is designed to be used in situations where hdfview is overkill. It is distributed under the open-source MIT license.

NOTE: h5cat is no longer maintained

See the excellent h5glance for a more modern replacement:

https://pypi.org/project/h5glance/#description

Requirements (tested versions)

  • Python 2.7, 3.5+
  • numpy (<2.0)
  • h5py (<3.0)

All of the above are included in the Enthought Python Distribution, so I would recommend you just install that if you can. argparse is required if you are on Python 2.6 (but it is built in with 2.7).

Installation

pip install h5cat

Usage

Agglomeration

Run h5cat -h for a helpful message.

Here are a couple of examples to get you started.

By default, h5cat gives you the shape and type of every dataset in an HDF5 file.

$ h5cat single-channel-tr[0-3]-0-0.00.lzf.h5
>>> single-channel-tr1-0-0.00.lzf.h5

    stack
      shape:  (250, 250, 250) 
      type:  int32

    vi
      shape:  (3, 1) 
      type:  float64
>>> single-channel-tr2-0-0.00.lzf.h5

    stack
      shape:  (250, 250, 250) 
      type:  int32

    vi
      shape:  (3, 1) 
      type:  float64
>>> single-channel-tr3-0-0.00.lzf.h5

    stack
      shape:  (250, 250, 250) 
      type:  int32

    vi
      shape:  (3, 1) 
      type:  float64

If you want more details, use -v or --verbose to get a printout of the array. For large arrays this will be ...ed to show only the edges of the array as can be fit on screen. Use -g or --group to display only a specific group of the .h5 file.

$ h5cat -v -g vi single-channel-tr3-0-0.00.lzf.h5
>>> single-channel-tr3-0-0.00.lzf.h5

    vi
      shape:  (3, 1) 
      type:  float64
[[ 0.        ]
 [ 0.06224902]
 [ 2.23062383]]

h5cat's People

Contributors

jni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

h5cat's Issues

Failed with Python 3.6 and H5Py v2.8.0

Hi,
I just downloaded and tried your script on XUbuntu 18.04, with Python 3.6 and H5Py 2.8.0.
I got this error (on this example file).

$ h5cat example.hdf5
>>> example.hdf5

    env_0
Traceback (most recent call last):
  File "h5cat.py", line 44, in <module>
    main()
  File "h5cat.py", line 35, in main
    if type(f[g]) == h5py.highlevel.Dataset:
AttributeError: module 'h5py' has no attribute 'highlevel'

Thanks in advance!

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.