This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Tools for easy handling of hdf5 files

Project Description

The main idea behind hiisi module is to make the handling of hdf5 files as fluent as possible. Module contains higher level tools such as search and write methods that are build on top of h5py module.

HiisiHDF expands h5py.File class forms the base of the module. Using HiisiHDF file handle, users can search metadata from the file without any prior knowledge of the file structure. In addition, HiisiHDF contains methods for listing the datasets and groups in the file and a convenient method for creating and expanding hdf5 files.

HiisiHDF can be used as such or it can be used as base class for creating more specialized file handles for different types of data files. An example of custom data file handle is the hiisi.odim module that contains file handles for reading weather radar data files that follow the OPERA odim data format.

Examples

Open hdf5 file:

>>> from hiisi import HiisiHDF
>>> h5f = HiisiHDF('data.h5')

Get a list of datasets:

>>> for dataset in h5f.datasets():
        print(dataset)
'/dataset1/data1/data'
'/dataset1/data2/data'
'/dataset2/data1/data'
'/dataset2/data2/data'

Retrieve all instances of certain attribute:

>>> gen = h5f.attr_gen('elangle')
>>> pair = gen.next()
>>> print(pair.path)
'/dataset1/where'
>>> print(pair.value)
0.5

Create a new hdf5 file with content:

>>> h5f = HiisiHDF('newfile.h5', 'w')
>>> filedict = {'/':{'attr1':'A'},
                '/dataset1/data1/data':{'DATASET':np.zeros(100), 'quantity':'emptyarray'}, 'B':'b'}
>>> h5f.create_from_filedict(filedict)

Find the names of the groups that contain an attribute with a certain value:

>>> for result in h5f.search('elangle', 0.5, 0.1):
        print(result)
'/dataset1/where'

>>> for result in h5f.search('quantity', 'DBZH'):
        print(result)
'/dataset1/data2/what'
'/dataset2/data2/what'
'/dataset3/data2/what'
'/dataset4/data2/what'
'/dataset5/data2/what'

Find the names of the groups that contain a numerical attribute with a certain value or a value that is within the given tolerance:

>>> h5f.search('elangle', 0.5, tolerance=0.1)
[u'/dataset1/where']

Installation

Hiisi is dependent on numpy and h5py packages. If you have these dependencies already installed you can simply run pip install hiisi.

Installing the dependencies and the package

$ install pip
$ pip install numpy
$ pip install Cython
$ pip install h5py
$ pip install hiisi

License

This code is licensed under the MIT open source license.

Release History

Release History

This version
History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
hiisi-0.0.4.tar.gz (7.3 kB) Copy SHA256 Checksum SHA256 Source Mar 1, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting