This page provides Makefile templates and more C and Fortran 77 examples on how to read HDF-EOS5 swath data using the HDF-EOS5 library.
After you write a C program, you need to build a binary using a C compiler. One easy way to build the binary 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_swath
from read_swath.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_swath
to your own
executable 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 the program.
The following shows a skeleton of Makefile
that can be used to build read_swath
from
read_swath.f
. We assume that the 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_swath
from read_swath.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 CloudTopPressure data field, the Longitude field and the Latitude field from the HIRDLS swath.
Download one file here. You can see C code or Fortran 77 code that reads the L2gpValue data field, the Longitude field and the Latitude field from the BrO swath.
Download one file here. See C code or Fortran 77 code that reads the EffectiveCloudFraction data field, the Longitude field, the Latitude field from the ColumnAmountAerosol swath.
Download one file here. See C code or Fortran 77 code that reads the TropopausePressure data field, the Longitude field, the Latitude field from the AncillaryNadirSwath swath.