Hdf tools : HDF4 data format conversion tools
Application type(s): Data Conversion
Related project(s): Megha-Tropiques
Description
This package contains some data format conversion tools for HDF4 files :
- hdf2raw : write a HDF4 SDS to a binary file
- raw2hdf : write a 2D binary data to a HDF4 file
- ncf2hdf : convert a NETCDF file to an HDF one
Usage
hdf2raw
This tool extracts the data of a SDS in an HDF file, and writes it out to a binary file
hdf2raw [OPTIONS] -isds=<SDS-number> -of=<dest-file> <src-filei> <src-file> : the input HDF4 file <SDS-number> : the index of the SDS to dump ( starting from 0 ) <dest-file> : destination file ( directory path included ) [OPTIONS] -v verbose mode -overwrite overwrite the output file if already existent
raw2hdf
This tool writes the data of a binary file to a 2D HDF’s SDS
raw2hdf [-v] [-append] -size=<width>x<heighti> -type=<data_type> -of=<dest-file> <src-file> <src-file> : the input HDF4 file [OPTIONS] -v verbose mode -append append the data at the end of the HDF file -size size of the binary data array (<width>x<height>) -type type of the read binary data. Allowed types : float64|float32|int32|uint32|int16|uint16|int8|uint8|char8|uchar8 -isds Index of the sds to read (starting at 0) -of full output file name (path included)
ncf2hdf
ncf2hdf transforms NetCDF_file to an HDF file. It is possible to select only some SDS to extract and to deal with “dimensions” SDS either as standard SDS, or as coordinate vectors.
If NetCDF input file name has a known suffix (“nc”, “ncf” ou “netcdf”, any case), HDF output file has the same basename with the “hdf” suffix. Otherwise, HDF output file name is built by adding the “hdf” suffix at the end of NetCDF input file name.
ncf2hdf [-v] [-d] [-s sds1[,sds2,...]] <NetCDF_file> <NetCDF-file> : the input NETCDF file [OPTIONS] -v Displays some details about conversion on standard output. -d Deals with "dimension" SDS as standard SDS; the default is to deal with "dimension" SDS as coordinate vectors. -s The HDF output file will only contain specified SDS. One or more SDS must be specified by name in the comma-delimited list without space following this option.
Download
Sources can be downloaded here :
Package can be browsed here :
Compilation
Prerequisites
- a C compiler
- a HDF4 library, compiled with the NETCDF support enabled ( http://www.hdfgroup.org/products/hdf4/ )
Environment
First, set the pathes to the HDF4 library by defining the environment variables
- HDFINC=<HDF4-includes-directory> , where <HDF4-includes-directory> contains the HDF4 includes : hdf.h, mfhdf.h…
- HDFLIB=<HDF4-libraries-directory>, where <HDF4-libraries-directory> contains the HDF4 libraries : libdf.a ( or libdf.so ), libmfhdf.a ( or libmfhdf.so )
If you are using the bash shell, this can be done via the export command :
> export HDFINC=<HDF4-includes-directory> > export HDFLIB=<HDF4-libraries-directory>
Of course, replace <HDF4-includes-directory> and <HDF4-libraries-directory> by the real paths on your system.
Build
Build the application by running
> ./configure --prefix=<install-root-dir> > make > make install
If successfull, the tools will be situed in the <install-root-dir>/bin directory.
Copyright
Copyright (C) 2010 Icare – Site web ICARE
Bruno SIX, bruno.six@icare.univ-lille.fr
Jacques DESCLOITRES, jacques.descloitres@icare.univ-lille.fr
Nicolas PASCAL, nicolas.pascal@icare.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