This page provides Makefile templates and more C and Fortran 77 examples on how to read HDF-EOS5 grid data using the HDF-EOS5 library.
After you write a C program, you need to build the executable using a C compiler. One easy way to build the executable is to use h5cc, part of the HDF5 library.
We recommend that users create Makefile
to build binaries from C sources.
The following shows a skeleton of Makefile
that can be used to build
read_grid
from read_grid.c
.
CFLAGS
and LDFLAGS
set paths to the HDF-EOS5 library.
Users do not need to set paths to the HDF5 library here because h5cc
sets them automatically. LIBS
specifies libraries used by the program.
Both he5_hdfeos
and Gctp
are from HDF-EOS5. Change read_grid
to your own
exectuable name.
If users do not use h5cc, many switches may be required based on how the HDF5 library and the HDF-EOS5 library are built.
After creating your own Makefile
, type make
or gmake
to generate
the executable program.
As h5cc is used in C, h5fc, which is part of
the HDF5 binary distribution, can be used to build a Fortran program.
The following is a skeleton of Makefile
that can be used to build read_grid
from
read_grid.f
. We assumed GNU Fortran 77 compiler is available.
You may get linker errors regarding underscores. Probably, Fortran compilers provide
several options about underscores, and users need to adjust the option. For example,
we used -fno-underscoring
option.
Note that h5fc is not created if the HDF5 library is built without Fortran.
Still, users can build Fortran programs because the Fortran interfaces of the HDF-EOS5 library does
not depend on HDF5's Fortran wrapper library.
The following is one possible Makefile
that
builds read_grid
from read_grid.f
without using h5fc.
LDFLAGS
nor LIBS
needs to contain
the SZIP library path.
If you want to build your Fortran program with non-GNU compiler like Intel Fortran compiler or PGI Fortran compiler, do not specify any FFLAGS
option in your make file. The following is an example Makefile for Intel Fortran compiler.
After creating your own Makefile
, type make
or gmake
to generate
the executable program.
Download one file here. See C code or Fortran 77 code that reads the TerrainReflectivity data field from the ColumnAmountAerosol grid.
Download one file here. See C code or Fortran 77 code that reads the L3dmValue data field from the Temperature grid.
Download one file here. See C code or Fortran 77 code that reads the CH4AtSurface data field from the NadirGrid grid.