ReadRawFile: Useful Python module for reading binary files in a generic way

Language/Format: Numpy, Python
Application type(s): Data Read/Write
Related project(s):

Description

This tool is a generic Python module for reading for all binary files consisting in some headers followed by records with the same pattern.

Headers and record patterns are described in text files. Datasets are returned as Numpy arrays.

Limitation

In this version, multiple record patterns are not supported.

Usage

At the beginning of your Python code, add the line:

 from ReadRawFile import *

then use the following instruction:

 hdrs, dsets = ReadRawFile(file, hdr_descs, rec_desc, big [, dset_names])

where:

 file     : binary file to read
 hdr_descs: list of headers patterns description files
 rec_desc : record pattern description file
 big      : True if big-endian file, False otherwise
 dset_names: list of required dataset names (as defined in rec_desc);
  this argument can be omitted: in this case, all datasets are returned

A t-uple (hdrs, dsets) is returned, where hdrs and dsets are dictionnaries containing values for named variables of headers and record.

 

Download

Sources can be downloaded here :

ReadRawFile.v0.1.0

Package can be browsed here :

ReadRawFile

Compilation

Prerequisites

List prerequisites :

  • Python (2.5 ot higher)
  • Numpy (1.4 ot higher)

Environment

The module ReadRawFile.py must lie in a directory that will be scanned when searching Python Liraries.

You can copy the module in such a directory or add the parent directory of the module in the PYTHONPATH environment variable; if you are using the bash shell, this can be done via the export command :

> export PYTHONPATH=<Module Directory>:$PYTHONPATH 

Copyright

Copyright (C) 2010 Icare – ICARE web site

Bruno SIX, Bruno.Six@univ-lille.fr

This program is a free software; you can redistribute it and/or modify it under the terms of the CeCILL Public License as published by www.cecill.info (License version 2 or later).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL Public License for more details.

You should have received a copy of the CeCILL Public License along with this program; if not, please contact www.cecill.info

For any questions or concerns regarding this program, or general information about the ICARE Project, please email to contact@icare.univ-lille.fr

Author(s): Bruno SIX (ICARE)

More news

Development Tools

HDF5 reader: HDF5 files read library in many languages

Language/Sofware: C, Fortran, IDL, MATLAB, Python
Application type(s): Data Read/Write
Related project(s):
Description:
The library contains high-level read functions for HDF5 files in R and MATLAB.
Author(s): Aminata Ndiaye (CGTD)

25.08.2014

Development Tools

SSMIS tools: Useful Python software for reading SSMI binary files

Language/Sofware: Numpy, Python
Application type(s): Data Conversion, Data Read/Write
Related project(s):
Description:
This tool is a reading Python software for SSMI binary files consisting in some headers followed by records with the same pattern (Headers and record patterns are described in text files: ./conf/).
Datasets are returned as Numpy arrays and write in HDF4 file.
Author(s): Nicolas Henriot. Bruno Six (ICARE)

27.02.2014

Development Tools

SSMI_TOOLS: Useful Python software for reading SSMI binary files

Language/Sofware: Numpy, Python
Application type(s): Data Conversion, Data Read/Write
Related project(s):
Description:
This tool is a reading Python software for SSMI binary files consisting in some headers followed by records with the same pattern (Headers and record patterns are described in text files: ./conf/).
Datasets are returned as Numpy arrays and write in HDF4 file.
Author(s): Nicolas Henriot. Bruno Six (ICARE)

26.02.2014

Search