1 / 3

Use Case: A simple task done simply with Python and H5py *

Use Case: A simple task done simply with Python and H5py *. Daniel Kahn NPP Ozone PEATE Science Systems and Applications, Inc. 31 March 2009. Goal: Retrieve HDF5 file from Configuration Management (CM) and insert CM metadata into HDF5 file. * H5py was designed and written by Andrew Collette.

Télécharger la présentation

Use Case: A simple task done simply with Python and H5py *

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Use Case: A simple task done simply with Python and H5py* Daniel Kahn NPP Ozone PEATE Science Systems and Applications, Inc. 31 March 2009 Goal: Retrieve HDF5 file from Configuration Management (CM) and insert CM metadata into HDF5 file. *H5py was designed and written by Andrew Collette

  2. Python script to retrieve file from CM and store Rev number as attribute. #! /usr/bin/env python import sys import os import h5py Rev = sys.argv[1] # Specifiy CM path on command line SVNFilepath = sys.argv[2] # Specify revision number on #comand line. command = 'svn export -r ' + Rev + ' ' + SVNFilepath #Subversion # Command InStream = os.popen(command,'r')‏ ExportString = InStream.read()‏ ExportReturnCode = InStream.close()‏ Elements = SVNFilepath.split('/')‏ # HDF5 code fid = h5py.File(Elements[-1]) # Elements[-1] is file name fid.attrs['SVN Path and Revision'] = SVNFilepath + '@' + Rev fid.close()‏ H5py code in red. Note the minimal effort coding HDF5 calls.

  3. Conclusion: Python and the H5py module provide a means of manipulating HDF5 files with minimal development effort. Other comments: Python a efficient environment in which to develop develop software where the problem to be solved is not completely understood. Python, H5py and the numerical package Numpy provide means of doing time efficient numerical manipulations in an array based environment. Python's design as a modern programming language makes it appropriate for complex tasks for which a more simplistic, e.g. shell scripting, approach would be cumbersome. Python and related modules are open source which is useful when administering a license is inconvenient or prohibitive.

More Related